-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
64 lines (56 loc) · 1.1 KB
/
main.cpp
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
//
// main.cpp for Snake in /home/wilmot_p/PROJETS/Snake
//
// Made by WILMOT Pierre
// Login <[email protected]>
//
// Started on Thu Apr 26 23:56:55 2012 WILMOT Pierre
// Last update Sat May 19 00:37:22 2012 WILMOT Pierre
//
#include <iostream>
#include "Options.hpp"
#include "Map.hpp"
int main(int ac, char **av)
{
(void)ac;
(void)av;
Options o;
int c(250);
int best(0);
int best2(0);
o.parseOption(ac, av);
if (o.getInfinite())
c = 5;
Map m(c, o.getFromDB());
if (o.getInfinite())
{
while (m.hasLivingSnakes())
m.play();
}
else
{
int i(1);
int j(0);
int nb_tour(600);
while (1)
{
m.setTittle(i);
j = 0;
while (m.hasLivingSnakes() && m.userContinue() && j < nb_tour)
{
std::cout << "============== Tour [" << i << "] | " << j << "/" << nb_tour << " (" << best2 << ")(" << best << ")================" << std::endl;
m.play();
j++;
}
m.order();
best2 = m.fileLog(i);
m.mysqlLog(i);
if (best2 > best)
best = best2;
nb_tour = best * 150;
m.mute();
i++;
}
}
return (0);
}