-
Notifications
You must be signed in to change notification settings - Fork 0
/
retro_snake.c
31 lines (26 loc) · 1.09 KB
/
retro_snake.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/******************************************************************************
* retro_snake.c: *
* Executable code. *
* *
* Calls all the necessary functions that run the game. *
******************************************************************************/
#include "retro_snake_lib.h"
int main(int argc, char ** argv)
{
int size, win = 0, score = -SCORE_OFFSET;
char ** b = NULL;
char * food = NULL;
node_t *snake = NULL;
size = board_size(argc, atoi(argv[1]));
srand((unsigned int) time(NULL)); /* Generate pool of random numbers */
alloc_cont(&b, size);
init_board(b, size);
add_to_list(&snake, init_snake(b, size));
food = insert_food(b, size, &score, &win);
while(!win) {
play_game(b, size, &snake, food, &score, &win);
}
disp_board(b, size);
win_sxs(b, &snake, &score);
return 0;
}