refactor: removing a bunch of random bad code and fixing it with more readable code

This commit is contained in:
DarthMooMancer
2025-09-12 22:18:36 -04:00
parent e36ab27f2b
commit 9d3f6b3308
6 changed files with 49 additions and 51 deletions
+2 -3
View File
@@ -19,17 +19,16 @@ int main () {
std::ref(running));
while (running) {
body.check_collision(head);
body.check_new_tail();
if(body.m_body.size() >= (ROW * COL)) {
std::cout << "You win! Score: " + std::to_string(body.m_body.size()) << std::endl;
running = false;
} else if(body.m_collision) {
} else if(body.check_collision(head)) {
std::cout << "You died! Score: " + std::to_string(body.m_body.size()) << std::endl;
running = false;
}
head.get_new_pos();
fruit.get_new_pos(window.m_board, head, body.m_score);
fruit.get_new_pos(window.m_board, head);
body.get_new_pos(head);
head.m_previous_head.set_new_point(head.m_head.m_row, head.m_head.m_col, head.m_head.m_direction);