rework(snake): added tail get_new_point for managing tail movement
This commit is contained in:
+4
-2
@@ -1,7 +1,9 @@
|
||||
#ifndef GLOBALS_HPP
|
||||
#define GLOBALS_HPP
|
||||
|
||||
constexpr unsigned int ROW = 10;
|
||||
constexpr unsigned int COL = 10;
|
||||
#include <cstdint>
|
||||
|
||||
constexpr uint16_t ROW = 10;
|
||||
constexpr uint16_t COL = 10;
|
||||
|
||||
#endif // GLOBALS_HPP
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ struct Point {
|
||||
|
||||
std::string to_string() const;
|
||||
void clear(std::array<std::array<char, COL>, ROW> &arr) const;
|
||||
std::pair<int, int> get_point(int direction, int row, int col);
|
||||
std::pair<int, int> get_new_point(int direction, int row, int col);
|
||||
};
|
||||
|
||||
#endif // POINT_HPP
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
struct Snake {
|
||||
Snake(int default_direction);
|
||||
void create_tail(int row, int col);
|
||||
std::pair<int, int> get_new_point(int tail_index, int direction, int row, int col);
|
||||
void update_tails_count();
|
||||
|
||||
std::vector<Point> m_tails;
|
||||
|
||||
Reference in New Issue
Block a user