Newer
Older
# This file may not be shared/redistributed without permission. Please read copyright notice in the git repo. If this file contains other copyright notices disregard this text.
from irlc.ex01.agent import train
from irlc.pacman.pacman_environment import GymPacmanEnvironment
from irlc.utils.video_monitor import VideoMonitor
from irlc.ex03multisearch.multisearch_agents import GymMinimaxAgent
layout_str = """
%%%%%%%%%
% %
% %%%% %
% %
% P %
%%%% %
%%%% .G %
%%%% %
%%%%%%%%%
""".strip()
def gminmax(layout='smallClassic', layout_str=layout_str, Agent=None, depth=3, **kwargs):
zoom = 2
env = GymPacmanEnvironment(layout=layout, layout_str=layout_str, zoom=zoom, **kwargs)
agent = Agent(env, depth=depth)
from irlc import PlayWrapper
agent = PlayWrapper(agent, env)
env = VideoMonitor(env, agent=agent, agent_monitor_keys=tuple(), fps=10)
train(env, agent, num_episodes=30)
env.close()
if __name__ == "__main__":
d = 3
gminmax(layout='minimaxClassic', layout_str=layout_str, Agent=GymMinimaxAgent,depth=d)
# gminmax(layout='minimaxClassic', layout_str=layout_str, Agent=GymAlphaBetaAgent, depth=d)
# gminmax(layout='minimaxClassic', layout_str=layout_str, Agent=GymExpectimaxAgent,depth=d)