-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbasic.cpp
More file actions
47 lines (37 loc) · 950 Bytes
/
basic.cpp
File metadata and controls
47 lines (37 loc) · 950 Bytes
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
#include <iostream>
#include "grid.hpp"
int main()
{
int largest = 0;
int count = 0;
while(true)
{
grid g;
while(g.can_move())
{
bool east = g.action(direction::EAST);
east |= g.action(direction::EAST);
east |= g.action(direction::EAST);
bool south = g.action(direction::SOUTH);
bool west = g.action(direction::WEST);
west |= g.action(direction::WEST);
west |= g.action(direction::WEST);
if(!east && !south && !west)
{
g.action(direction::NORTH);
}
}
if(g.largest() > largest)
{
largest = g.largest();
std::cout << largest << std::endl;
g.print();
}
++count;
if(count % 1000 == 0)
{
std::cout << "game: " << count << std::endl;
}
}
return 0;
}