refactor: removing some deprecated functions and removed array for c style array

This commit is contained in:
DarthMooMancer
2025-09-12 20:31:42 -04:00
parent cfa0e52705
commit 4bab69a3a8
9 changed files with 33 additions and 58 deletions
+7 -1
View File
@@ -2,12 +2,18 @@
#include <cstdlib>
#include <ctime>
void Point::set_new_point(int row, int col, int dir) {
m_row = row;
m_col = col;
m_direction = dir;
}
Fruit::Fruit() {
std::srand(std::time(0));
m_point.set_new_point((rand() % 9), (rand() % 9), 0);
}
void Fruit::get_new_pos(std::array<std::array<char, COL>, ROW> &board, Head &head, int &score) {
void Fruit::get_new_pos(char (&board)[ROW][COL], Head &head, int &score) {
if(m_point.m_row == head.m_head.m_row && m_point.m_col == head.m_head.m_col) {
m_point.set_new_point((rand() % 9), (rand() % 9), 0);
score++;