@ -22,3 +22,5 @@ void printChar(int y, int x, graphics_input img);
void printMsg(int y, int x, char *str);
char readChar(int y, int x);
int readInpt();
void advanceDifficulty(void);
@ -23,6 +23,7 @@ int Controller::act(void){
if (snake->hasBitSnack(this->snack.getY(), this->snack.getX()) == true)
{
advanceDifficulty();
generateSnack(this->snack);
this->snake->incSize();
}
@ -75,3 +75,7 @@ int readInpt(){
return getch();
void advanceDifficulty(void){
if(sleepTime > 28000000) // we set 28000000 as teh min sleep time
sleepTime -= 1000000;
@ -10,8 +10,8 @@ void generateSnack(Point &snack){
int x, y;
x = (rand() + 1) % GAME_RIGHT_WALL_X;
y = (rand() + 1) % GAME_BOTTOM_WALL_Y;
x = rand() % GAME_RIGHT_WALL_X + 1;
y = rand() % GAME_BOTTOM_WALL_Y + 1;
snack.setPoint(y, x);