mirror of
https://github.com/ProgramSnail/snake_2024.git
synced 2025-12-30 10:08:15 +00:00
functional bots, small refactoring, readme edit
This commit is contained in:
parent
5299e89633
commit
7e67a3bd30
13 changed files with 179 additions and 91 deletions
|
|
@ -65,6 +65,14 @@ inline int rand_to(int x) {
|
|||
return (is_negative ? -1 : 1) + rand() % std::abs(x);
|
||||
}
|
||||
|
||||
inline int rand_in_range(int x, int y) {
|
||||
if (x > y) {
|
||||
std::swap(x, y);
|
||||
}
|
||||
|
||||
return rand_to(y - x) + x;
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
|
||||
namespace color {
|
||||
|
|
@ -107,7 +115,7 @@ using color::Color;
|
|||
class GameObject {
|
||||
public:
|
||||
virtual void act(float dt) = 0;
|
||||
virtual void draw(Veci offset) = 0;
|
||||
virtual void draw(Veci offset) const = 0;
|
||||
|
||||
virtual ~GameObject() {}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue