42 lines
841 B
C++
42 lines
841 B
C++
#ifndef SNAKE_HPP
|
|
#define SNAKE_HPP
|
|
|
|
#include <vector>
|
|
#include "point.hpp"
|
|
|
|
/* 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
|
|
*/
|
|
|
|
/* 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
|