-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestMinimax.py
More file actions
38 lines (34 loc) · 1.12 KB
/
Copy pathtestMinimax.py
File metadata and controls
38 lines (34 loc) · 1.12 KB
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
from Board import *
from LocalSearch import *
from time import perf_counter
if __name__ == "__main__":
b3 = Board()
b3.parse_terrain("terrain_3M_official_1.txt")
blue_searcher = HillClimbingFirstChoice(b3, "blue")
brown_searcher = HillClimbingFirstChoice(b3, "brown")
blue_random = blue_searcher.get_random_start()
brown_random = brown_searcher.get_random_start()
b3.place_pieces("blue", blue_random)
b3.place_pieces("brown", brown_random)
b3.display()
start = perf_counter()
count = 0
for m in b3.get_all_moves_ref("brown"):
count += 1
end = perf_counter()
print("Time elapsed (get_all_moves_ref): ", (end-start))
print("num moves generated: ", count)
print()
start = perf_counter()
count = 0
for m in b3.get_all_moves("brown"):
count += 1
end = perf_counter()
print("Time elapsed (get_all_moves): ", (end-start))
print("num moves generated: ", count)
print()
start = perf_counter()
test = b3.get_num_all_moves("brown")
end = perf_counter()
print("Time elapsed (get_num_all_moves): ", (end-start))
print(test)