from agents import DeepQLearningAgent, RandomAgent, TabQLearningAgent, DeepQLearningExperienceReplayAgent, \ DoubleDeepQLearningAgent from environments.battle_royale import BattleRoyalGameWorldTerminal, BattleRoyale from runners import run_for_n_games_and_print_stats, run_step import tensorflow as tf if __name__ == "__main__": tf.compat.v1.disable_eager_execution() list_agent=[DoubleDeepQLearningAgent(action_space_size=48) if i <7 else TabQLearningAgent() for i in range(2)] for _ in range(100): gs = BattleRoyalGameWorldTerminal(0,numberofPlayer=2,list_agent = list_agent) gs.run() list_agent[0].epsilon = -1 list_agent[1].epsilon = -1 gs2 = BattleRoyale(numberofPlayer=2,list_agent=list_agent) gs2.run()
from agents import DeepQLearningAgent, RandomAgent, TabQLearningAgent from environments.battle_royale import BattleRoyalGameWorldTerminal, BattleRoyale from runners import run_for_n_games_and_print_stats, run_step if __name__ == "__main__": list_agent = [ TabQLearningAgent() if i < 7 else RandomAgent() for i in range(6) ] for i in range(1000): gs = BattleRoyalGameWorldTerminal(i, list_agent=list_agent) gs.run() #list_agent[0].epsilon =-1 #list_agent[1].epsilon = -1 gs2 = BattleRoyale(list_agent=list_agent) gs2.run()
from agents import TabQLearningAgent from environments import GridWorldGameState from runners import run_for_n_games_and_print_stats, run_step if __name__ == "__main__": gs = GridWorldGameState() agent = TabQLearningAgent() for _ in range(500): run_for_n_games_and_print_stats([agent], gs, 100) agent.epsilon = -1.0 run_for_n_games_and_print_stats([agent], gs, 100) gs = gs.clone() while not gs.is_game_over(): run_step([agent], gs) print(gs)
from agents import DeepQLearningAgent, RandomAgent, TabQLearningAgent, DeepQLearningExperienceReplayAgent, \ DoubleDeepQLearningAgent, DoubleDeepQLearningExprerienceReplayAgent from environments.battle_royale import BattleRoyalGameWorldTerminal, BattleRoyale from runners import run_for_n_games_and_print_stats, run_step import tensorflow as tf if __name__ == "__main__": tf.compat.v1.disable_eager_execution() list_agent = [ DoubleDeepQLearningExprerienceReplayAgent( action_space_size=48) if i < 7 else TabQLearningAgent() for i in range(2) ] for i in range(100): gs = BattleRoyalGameWorldTerminal(i, numberofPlayer=2, list_agent=list_agent) gs.run() #list_agent[0].epsilon = -1 #list_agent[1].epsilon = -1 gs2 = BattleRoyale(numberofPlayer=2, list_agent=list_agent) gs2.run()
from agents import TabQLearningAgent, CommandLineAgent, RandomAgent from environments.tictactoe import TicTacToeGameState from runners import run_for_n_games_and_print_stats, run_step if __name__ == "__main__": gs = TicTacToeGameState() agent0 = TabQLearningAgent() agent1 = TabQLearningAgent() agent0.alpha = 0.1 agent0.epsilon = 0.005 agent1.alpha = 0.1 agent1.epsilon = 0.005 for _ in range(100): run_for_n_games_and_print_stats([agent0, agent1], gs, 5000) agent0.epsilon = -1.0 agent1.epsilon = -1.0 run_for_n_games_and_print_stats([agent0, agent1], gs, 100) gs_clone = gs.clone() while not gs_clone.is_game_over(): run_step([agent0, CommandLineAgent()], gs_clone) print(gs_clone) gs_clone = gs.clone() while not gs_clone.is_game_over(): run_step([CommandLineAgent(), agent1], gs_clone) print(gs_clone)
from agents import RandomAgent, TabQLearningAgent from environments.battle_royale import BattleRoyale from runners import run_for_n_games_and_print_stats, run_step if __name__ == "__main__": list_agent = list([TabQLearningAgent() for i in range(6)]) gs = BattleRoyale(list_agent=list_agent) gs.run()
def run_BattleRoyal(i): list_agent = [DeepQLearningAgent(action_space_size=48) if i < 3 else TabQLearningAgent() for i in range(6)] Terminalworld = BattleRoyalGameWorldTerminal(i,list_agent=list_agent) a = Terminalworld.run() return a