-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
48 lines (45 loc) · 1.43 KB
/
main.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hlecuyer <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/02/28 09:35:55 by hlecuyer #+# #+# */
/* Updated: 2015/03/01 16:00:00 by fmarmol ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "game_2048.h"
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(void)
{
t_grid grid;
t_env env;
int res;
srand(time(0));
init_ncurses(&env);
if (menu(&env))
{
init_grid(&env, &grid);
res = main_loop(&env, &grid);
free_struct(&env, &grid);
endwin();
if (res == 1)
ft_putendl("You win!!!");
else if (res == -1)
ft_putendl("You loose!!!");
else
ft_putendl("Thank you for playing!!!");
}
else
{
endwin();
ft_putendl("GoodBye!!");
}
return (0);
}