wip
This commit is contained in:
+31
-7
@@ -4,14 +4,38 @@
|
||||
#include <vector>
|
||||
#include "point.hpp"
|
||||
|
||||
struct Snake {
|
||||
Snake(int default_direction, int row, int col);
|
||||
Point m_head;
|
||||
std::vector<Point> m_tails;
|
||||
int m_direction; // 1: Down, 2: Up, 3: Left, 4: Right
|
||||
/* NOTE
|
||||
* tail
|
||||
* ARGS
|
||||
* - direction
|
||||
* - old point
|
||||
* - new point
|
||||
* - new direction (x and y of old point and what direction it needs to swtich to so once it gets to it changes)
|
||||
* - symbol
|
||||
* IMPLEMENTATION
|
||||
* - predict the new point
|
||||
* - save old point
|
||||
* - find if previous tail has new direction
|
||||
* - once tail hits point change direction
|
||||
*/
|
||||
|
||||
void create_tail(int row, int col); // Adds a new tail to m_tails at { row, col }
|
||||
void get_new_tail_point(int tail_index, int direction);
|
||||
/* Struct Tail
|
||||
* separate the snake and tail from each other
|
||||
* */
|
||||
|
||||
struct Snake {
|
||||
Snake(int default_direction, int row, int col);
|
||||
Point m_head;
|
||||
std::vector<Point> m_tails;
|
||||
// 1: Down, 2: Up, 3: Left, 4: Right
|
||||
int m_direction;
|
||||
// Adds a new tail to m_tails at { row, col }
|
||||
void create_tail(int row, int col);
|
||||
void get_new_head_point(int tail_index, int direction);
|
||||
};
|
||||
|
||||
// struct Tail {
|
||||
//
|
||||
// }
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user