-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeira_file.py
65 lines (61 loc) · 3.39 KB
/
meira_file.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
62
63
64
import time
from datetime import datetime
from agents.alpha_beta_agent import AlphaBetaAgent
from agents.guessing_alpha_beta_agent import GuessingAlphaBetaAgent
from agents.human_agent import HumanAgent
from agents.init_agents.init_hill_climbing_agent import InitHillClimbingAgent
from agents.init_agents.init_human_agent import InitHumanAgent
from agents.init_agents.init_random_agent import InitRandomAgent
from agents.random_agent import RandomAgent
from game import StrategoGame
from graphics.console_graphic import ConsoleGraphic
from graphics.gui_graphic import GuiGraphic
from constants import Color
# from soldier import Color
from agents.init_agents.init_heuristics import *
from agents.opponent_actions import *
from agents.heuristics import *
if __name__ == '__main__':
# # <<<<<<< HEAD
# graphic = ConsoleGraphic(10, 0)
graphic = GuiGraphic(10, 2)
# red_agent = AlphaBetaAgent(Color.RED, graphic, InitHillClimbingAgent(init_take_1_heuristic), depth=2,
# heuristic=try_heuristic, opponent_heuristic=try_heuristic,
# get_legal_actions_opponent=do_not_use_me_ever)
red_agent = GuessingAlphaBetaAgent(Color.RED, graphic, InitHillClimbingAgent(init_scattering_heuristic), depth=2,
heuristic=sum_of_heuristics_heuristic,
opponent_heuristic=min_opp_soldiers_num_heuristic,
get_legal_actions_opponent=do_not_use_me_ever)
# red_agent = RandomAgent(Color.RED, graphic, InitHillClimbingAgent(init_take_2_heuristic))
blue_agent = RandomAgent(Color.BLUE, graphic)
# num_games = 10
# for i in range(num_games):
# game = StrategoGame(red_agent, blue_agent, graphic)
# s_time = time.time()
# score, turn_count = game.run()
# e_time = time.time()
# print(f"Time: {e_time - s_time} sec, Turns: {turn_count}")
#
# graphic = ConsoleGraphic(10, 0)
# # graphic = GuiGraphic(10, 2)
game = StrategoGame(red_agent, blue_agent, graphic)
score = game.run()
# # =======
# graphic = ConsoleGraphic(10, 0)
# graphic = GuiGraphic(10, 2)
# red_agent = AlphaBetaAgent(Color.RED, graphic, InitRandomAgent(), depth=2,
# heuristic=sum_of_heuristics_heuristic,
# opponent_heuristic=sum_of_heuristics_heuristic,
# get_legal_actions_opponent=legal_actions_from_subset_guess,
# get_successor_opponents=naive_opp_get_successor)
# red_agent = GuessingAlphaBetaAgent(Color.RED, graphic, InitRandomAgent(), depth=2,
# heuristic=sum_of_heuristics_heuristic,
# opponent_heuristic=min_opp_soldiers_num_heuristic,
# get_legal_actions_opponent=do_not_use_me_ever)
# red_agent = RandomAgent(Color.RED, graphic)
# blue_agent = RandomAgent(Color.BLUE, graphic)
# blue_agent = GuessingAlphaBetaAgent(Color.BLUE, graphic, InitRandomAgent(), depth=2,
# heuristic=min_opp_soldiers_num_heuristic,
# opponent_heuristic=sum_of_heuristics_heuristic,
# get_legal_actions_opponent=do_not_use_me_ever)
# >>>>>>> ea2ff9ce5bc24a5bced1e8b4ac4dcdb4da210720