Skip to content

Commit

Permalink
Adding latest training data & failsafe in case loading data doesent work
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoSdV committed May 15, 2023
1 parent 6e7b1b4 commit 6fee9ed
Show file tree
Hide file tree
Showing 23 changed files with 21 additions and 31 deletions.
1 change: 0 additions & 1 deletion mab/data/training_data/new_model_best_actions.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/new_model_num_games.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/new_model_results_table.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/one_action_best_actions.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/one_action_num_games.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/one_action_results_table.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/rnd1_best_actions.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/rnd1_num_games.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/rnd1_results_table.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/rnd_best_actions.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/rnd_num_games.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/rnd_results_table.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/v2_best_actions.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/v2_num_games.json

This file was deleted.

1 change: 0 additions & 1 deletion mab/data/training_data/v2_results_table.json

This file was deleted.

1 change: 1 addition & 0 deletions mab/data/training_data/v3_best_actions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"0": "sBBBBBBBBBBBBBBBlAAAAAAAAAAAAAAAhDDDDDDDDDDDDDDDmDDDDDDDDDDDDDDDaEEEEEEEEEEEEEEE", "1": "sEEEEEEEEEEEEEEElAAAAAAAAAAAAAAAhEEEEEEEEEEEEEEEmBBBBBBBBBBBBBBBaCCCCCCCCCCCCCCC", "2": "sEEEEEEEEEEEEEEElDDDDDDDDDDDDDDDhDDDDDDDDDDDDDDDmAAAAAAAAAAAAAAAaDDDDDDDDDDDDDDD"}
1 change: 1 addition & 0 deletions mab/data/training_data/v3_num_games.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
130010
1 change: 1 addition & 0 deletions mab/data/training_data/v3_results_table.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions mab/data/training_data/v5_best_actions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"0": "sEEEEEEEEEEEEEEElAAAAAAAAAAAAAAAhEEEEEEEEEEEEEEEmBBBBBBBBBBBBBBBaCCCCCCCCCCCCCCC", "1": "sEEEEEEEEEEEEEEElDDDDDDDDDDDDDDDhDDDDDDDDDDDDDDDmAAAAAAAAAAAAAAAaDDDDDDDDDDDDDDD", "2": "sBBBBBBBBBBBBBBBlAAAAAAAAAAAAAAAhDDDDDDDDDDDDDDDmDDDDDDDDDDDDDDDaEEEEEEEEEEEEEEE"}
1 change: 1 addition & 0 deletions mab/data/training_data/v6_best_actions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"0": "sEEEEEEEEEEEEEEElDDDDDDDDDDDDDDDhDDDDDDDDDDDDDDDmAAAAAAAAAAAAAAAaDDDDDDDDDDDDDDD", "1": "sBBBBBBBBBBBBBBBlAAAAAAAAAAAAAAAhDDDDDDDDDDDDDDDmDDDDDDDDDDDDDDDaEEEEEEEEEEEEEEE", "2": "sEEEEEEEEEEEEEEElAAAAAAAAAAAAAAAhEEEEEEEEEEEEEEEmBBBBBBBBBBBBBBBaCCCCCCCCCCCCCCC"}
2 changes: 1 addition & 1 deletion mab/local_game/local_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __run(self, game_actions: dict[int, str], num_turns: int, num_players: int)
while not winner and current_turn[0] <= num_turns:
game_map.register_new_turn()

player_idx = (current_turn[0] - 1) % num_players
player_idx = current_turn[0] % num_players
player = players[player_idx]
player.register_turn()
player.run()
Expand Down
2 changes: 1 addition & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
HEX_RADIUS_Y = [-1]

# mab constants
DEFAULT_ACTION_FILE = 'v2'
DEFAULT_ACTION_FILE = 'v6'

TANK_PULSE_FULL_DURATION = 20
TANK_SHADOW_MAX_SCALE = 2.5
Expand Down
28 changes: 14 additions & 14 deletions src/players/types/bot_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,26 @@ def __place_actions(self) -> None:
# Types: spg, light_tank, heavy_tank, medium_tank, at_spg
if self.__actions is not None:
this_bots_actions = self.__actions.get(self.__order)
else:
this_bots_actions = None

if this_bots_actions is not None:
for tank in self._tanks:
this_rounds_action = this_bots_actions[tank.type][self._current_turn[0] // self._num_players]
self.__do(this_rounds_action, tank)
else:
# testing catapult action
# for tank in self._tanks:
# if tank.catapult_bonus:
# self.__do('C', tank)
# else:
# self.__do('F', tank)

# testing random actions
# Default model just in case
for tank in self._tanks:
action = None
can_repair = self.__tank_names_can_repair[tank.type]
possible_actions = self.__actions if can_repair else self.__no_repair_actions
while action not in possible_actions:
action = self.__actions[rnd.randint(0, len(possible_actions) - 1)]
self.__do(action, tank)
if tank.type == 'spg':
self.__do('E', tank)
elif tank.type == 'light_tank':
self.__do('D', tank)
elif tank.type == 'heavy_tank':
self.__do('D', tank)
elif tank.type == 'medium_tank':
self.__do('A', tank)
elif tank.type == 'at_spg':
self.__do('D', tank)

def __do(self, action: str, tank: Tank) -> None:
# ML actions
Expand Down

0 comments on commit 6fee9ed

Please sign in to comment.