-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstratego.py
61 lines (48 loc) · 1.87 KB
/
stratego.py
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
import time
from args_parser import ArgsParser
from game import StrategoGame
from agents.heuristics import *
from agents.opponent_actions import *
from graphics.graphic import Graphic
def main():
my_parser = ArgsParser()
my_parser.parse()
graphic = Graphic(BOARD_SIZE)
red_agent = my_parser.get_agent(Color.RED, graphic)
blue_agent = my_parser.get_agent(Color.BLUE, graphic)
evaluation_function = my_parser.get_evaluation_function()
num_of_games = my_parser.get_num_of_games()
for i in range(num_of_games):
graphic = my_parser.get_graphic()
red_agent.graphic = graphic
blue_agent.graphic = graphic
game = StrategoGame(red_agent, blue_agent, graphic, evaluation_function)
s_time = time.time()
score, turn_count = game.run()
e_time = time.time()
print(f"Time: {e_time - s_time:.5f} sec, Turns: {turn_count}")
if __name__ == '__main__':
main()
"""
Possible Command Line Arguments:
empty console:
1. --display console --num_players_to_show 0
2. -g console -p 0
6 games:
1. --num_of_games 6
2. -n 6
evaluation function=evaluate_num_soldiers:
1. --evaluation_function evaluate_num_soldiers
2. -e evaluate_num_soldiers
red init hill climbing agent, init_take_1_heuristic:
1. --red_init_agent InitHillClimbingAgent --red_init_heuristic init_take_1_heuristic
2. -ria InitHillClimbingAgent -rih init_take_1_heuristic
blue alpha beta agent, random_heuristic, ...:
1. --blue_agent AlphaBetaAgent --blue_heuristic random_heuristic
2. -ba AlphaBetaAgent -bh random_heuristic
interesting games:
1. -g gui -p 1 -ba RandomAgent -ra GuessingAlphaBetaAgent -rih init_take_1_heuristic -rh interesting_heuristic -d 1 -n 5
2. -g gui -p 2 -ba RandomAgent -ra GuessingAlphaBetaAgent -ria InitHillClimbingAgent -rih init_take_2_heuristic -rh
naive_unit_count_heuristic -d 1 -n 5 -e naive_unit_value_count_evaluator
3.
"""