-
Notifications
You must be signed in to change notification settings - Fork 2
/
list.h
64 lines (41 loc) · 1.31 KB
/
list.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: list.h
* Author: Anderson Souza <jair_anderson_bs@hotmail.com>
*
* Created on March 27, 2018, 7:11 PM
*/
#include <stdlib.h>
#include <time.h>
#include <ncurses.h>
#define size_screen_y getmaxy(stdscr)
#define size_screen_x getmaxx(stdscr)
#define down 0402
#define up 0403
#define left 0404
#define right 0405
typedef struct screen Screen;
typedef struct food Food;
typedef struct snake Snake;
time_t t;
Screen* init_game(int y, int x);
Screen* create_screen(int y, int x);
int calculate_middle_screen(int value);
void print_snake(Screen* screen);
void print_food(Screen * screen);
Snake* create_snake(int y, int x);
void kill_screen();
void free_snake(Screen* screen);
void free_screen(Screen* screen);
Snake* calculate_coordinate(int y, int x, int newDirection);
int snake_touched_itself(Screen* screen, Snake* snakeTemp);
Screen* calculate_next_cell(Screen* screen, Snake* newSnake);
int movement_not_crash_in_the_wall(Snake* snake);
int find_food(Screen* screen, Snake* snake, int movement);
int next_movement(Screen* screen, int movement);
void create_food(Screen* screen);
void free_food(Screen* screen);