You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// INFO: there is idea for more original way of spawn food, so it can be spawn under snake, but if you want to implemetn it you need to add second logical layer on field so field will be 2D array of 'struct point { int topl; int bottoml};'. Now food can't be spawn under snale for code simplicity (which was orinial ideas).
void food_spawn()
{
if (food_was_eaten) {
int x = 0;
int y = 0;
do {
x = 1 + rand() % (FIELD_MAX_X-2);
y = 1 + rand() % (FIELD_MAX_Y-2);
} while (field[y][x] == SNAKE); // food can't be spawn under snake