-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
55 lines (50 loc) · 1.06 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
49
50
51
52
53
54
55
/*
** main.c for dante in /home/nasrat_v/rendu/Initiation_IA/dante
**
** Made by nasrat_v
** Login <[email protected]>
**
** Started on Sun May 29 15:55:19 2016 nasrat_v
** Last update Fri Oct 27 13:41:07 2017 Valentin Nasraty
*/
#include "solver.h"
void init_ncurses()
{
SCREEN *win;
win = newterm(NULL, stderr, stdin);
set_term(win);
refresh();
keypad(stdscr, 1);
curs_set(0);
start_color();
noecho();
}
int main(int ac, char **av)
{
t_struct st;
if (ac == 2)
{
if ((read_map(&st, av[1])) == 1)
return (0);
st.y = my_tablen(st.tab);
st.x = my_count_col(st.tab);
init_ncurses();
my_show_wordtab(st.tab);
if ((set_begin_end(&st)) == 0)
{
write(1, "No solution found\n", my_strlen("No solution found\n"));
return (0);
}
if ((resolve(&st, 0, 0)) == 0)
{
write(1, "No solution found\n", my_strlen("No solution found\n"));
return (0);
}
modif_for_push(&st);
my_putchar('\n');
}
else
return (1);
endwin();
return (0);
}