cleaning up comments
This commit is contained in:
+3
-7
@@ -1,6 +1,6 @@
|
|||||||
#include "element.hpp"
|
#include "element.hpp"
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cstdlib>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
int _score = 0;
|
int _score = 0;
|
||||||
@@ -54,11 +54,6 @@ void move_tail_indicies(Point** buffer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _append_tail(Point** buffer) {
|
|
||||||
memmove(buffer + 4, buffer + 3, (_snake_size - 3) * sizeof(Point*));
|
|
||||||
buffer[3] = new Point { ROW, COL, '@' };
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_fruit_eaten(Point* (*board)[COL], Point** buffer) {
|
void on_fruit_eaten(Point* (*board)[COL], Point** buffer) {
|
||||||
int row, col;
|
int row, col;
|
||||||
if(buffer[2]->m_row == buffer[0]->m_row && buffer[2]->m_col == buffer[0]->m_col) {
|
if(buffer[2]->m_row == buffer[0]->m_row && buffer[2]->m_col == buffer[0]->m_col) {
|
||||||
@@ -67,7 +62,8 @@ void on_fruit_eaten(Point* (*board)[COL], Point** buffer) {
|
|||||||
col = (rand() % COL);
|
col = (rand() % COL);
|
||||||
} while (board[row][col] != nullptr);
|
} while (board[row][col] != nullptr);
|
||||||
buffer[2]->set_new_point(row, col);
|
buffer[2]->set_new_point(row, col);
|
||||||
_append_tail(buffer);
|
memmove(buffer + 4, buffer + 3, (_snake_size - 3) * sizeof(Point*));
|
||||||
|
buffer[3] = new Point { ROW, COL, '@' };
|
||||||
_score++;
|
_score++;
|
||||||
_snake_size++;
|
_snake_size++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user