refactor: renamed snake to element and moved fruit to element. Removed a lot of unused functions and variables

This commit is contained in:
DarthMooMancer
2025-08-30 01:09:50 -04:00
parent d488f6464a
commit 96e5eb9930
15 changed files with 159 additions and 246 deletions
+36
View File
@@ -0,0 +1,36 @@
#ifndef ELEMENT_HPP
#define ELEMENT_HPP
#include <vector>
#include "point.hpp"
struct Head {
Head();
Point m_head;
Point m_previous_head;
void get_new_pos();
};
struct Tail {
Point m_tail_pos;
Point m_previous_tail_pos;
};
struct Body {
Body();
std::vector<Tail> m_body;
int m_score;
bool m_collision;
void clear(std::array<std::array<char, COL>, ROW> &arr);
void add_tail();
void get_new_points(Head &head);
void collision(Head &head);
};
struct Fruit {
Fruit();
Point m_point;
void get_new_pos(std::array<std::array<char, COL>, ROW> &board, Head &head, int &score);
};
#endif // ELEMENT_HPP