changes from m_row & m_col to x & y

This commit is contained in:
DarthMooMancer
2025-11-03 13:09:37 -05:00
parent ab16f18137
commit 2c38da4b79
4 changed files with 35 additions and 35 deletions
+4 -5
View File
@@ -11,9 +11,9 @@ int main () {
bool running = true;
Point* buffer[MAX_LEN] = {}; // 2 for head, 1 for fruit, rest for tail
buffer[HEAD] = new Point { ROW / 2, COL / 2, '*' }; // Head
buffer[PREVIOUS_HEAD] = new Point { buffer[HEAD]->m_row, buffer[HEAD]->m_col, '.' };
buffer[FRUIT] = new Point { (rand() % ROW), (rand() % COL), 'o' }; // Fruit
buffer[HEAD] = new Point { COL / 2, ROW / 2, '*' };
buffer[PREVIOUS_HEAD] = new Point { buffer[HEAD]->x, buffer[HEAD]->y, '.' };
buffer[FRUIT] = new Point { (rand() % COL), (rand() % ROW), 'o' };
std::thread input_thread([&] { get_input(buffer[HEAD]->m_dir, running ); } );
@@ -25,8 +25,7 @@ int main () {
if(buffer[MAX_LEN - 1] != nullptr) {
std::cout << "You filled the whole board and won! Score: " << get_score() << std::endl;
running = false;
}
if(segment_overlap(buffer)) {
} if(segment_overlap(buffer)) {
std::cout << "You collided with yourself and died! Score: " << get_score() << std::endl;
running = false;
}