refresh
This commit is contained in:
parent
54883b281c
commit
69de444a34
14
a3/main.c
14
a3/main.c
@ -1,11 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "snake.h"
|
#include "snake.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
@ -20,19 +15,15 @@ int main(void) {
|
|||||||
char command = read_input();
|
char command = read_input();
|
||||||
|
|
||||||
change_direction(&game_state, command);
|
change_direction(&game_state, command);
|
||||||
|
|
||||||
int outcome = step_state(&game_state);
|
int outcome = step_state(&game_state);
|
||||||
|
|
||||||
draw_world(&game_state);
|
draw_world(&game_state);
|
||||||
|
|
||||||
if (outcome != END_CONTINUE) {
|
if (outcome != END_CONTINUE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
sleep(1);
|
||||||
Sleep(1000);
|
|
||||||
#else
|
|
||||||
sleep(1);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free_snake(game_state.snake);
|
free_snake(game_state.snake);
|
||||||
@ -40,3 +31,4 @@ int main(void) {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user