from snake.game import Game, GameConf, GameMode greedy = "GreedySolver" hamilton = "HamiltonSolver" normal = GameMode.NORMAL conf = GameConf() conf.solver_name = hamilton conf.mode = normal print("Solver: %s " % (conf.solver_name)) print("Mode: %s" % (conf.mode)) Game(conf).run()
"greedy": "GreedySolver", "hamilton": "HamiltonSolver", "dqn": "DQNSolver", } dict_mode = { "normal": GameMode.NORMAL, "bcmk": GameMode.BENCHMARK, "train_dqn": GameMode.TRAIN_DQN, "train_dqn_gui": GameMode.TRAIN_DQN_GUI, } parser = argparse.ArgumentParser(description="Run snake game agent.") parser.add_argument( "-s", default="greedy", choices=dict_solver.keys(), help="name of the solver to direct the snake (default: hamilton)") parser.add_argument("-m", default="normal", choices=dict_mode.keys(), help="game mode (default: normal)") args = parser.parse_args() conf = GameConf() conf.solver_name = dict_solver[args.s] conf.mode = dict_mode[args.m] print("Solver: %s Mode: %s" % (conf.solver_name, conf.mode)) Game(conf).run()
from snake.game import Game, GameConf, GameMode greedy = "GreedySolver" hamilton = "HamiltonSolver" normal = GameMode.NORMAL conf = GameConf() conf.solver_name = greedy conf.mode = normal print("Solver: %s " % (conf.solver_name)) print("Mode: %s" % (conf.mode)) Game(conf).run()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=C0103,C0111 from snake.game import GameConf, Game conf = GameConf() conf.solver_name = "NeuralSolver" #conf.solver_name = "HamiltonSolver" #conf.solver_name = "GreedySolver" Game(conf).run()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=C0103,C0111 import sys from snake.game import Game, GameConf, GameMode sys.tracebacklimit = 0 dict_solver = { "g": "GreedySolver", "h": "HamiltonSolver", } dict_mode = { "n": GameMode.NORMAL, "b": GameMode.BENCHMARK, } conf = GameConf() conf.solver_name = dict_solver["g"] conf.mode = dict_mode["b"] print("Solver: %s Mode: %s" % (conf.solver_name, conf.mode)) Game(conf).run()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=C0103,C0111 from snake.game import GameConf, Game conf = GameConf() conf.solver_name = "HamiltonSolver" #conf.solver_name = "GreedySolver" Game(conf).run()
import argparse from snake.game import Game, GameConf, GameMode dict_solver = { "greedy": "GreedySolver", "hamilton": "HamiltonSolver", "dqn": "DQNSolver", } dict_mode = { "normal": GameMode.NORMAL, "bcmk": GameMode.BENCHMARK, "train_dqn": GameMode.TRAIN_DQN, "train_dqn_gui": GameMode.TRAIN_DQN_GUI, } parser = argparse.ArgumentParser(description="Run snake game agent.") parser.add_argument("-s", default="hamilton", choices=dict_solver.keys(), help="name of the solver to direct the snake (default: hamilton)") parser.add_argument("-m", default="normal", choices=dict_mode.keys(), help="game mode (default: normal)") args = parser.parse_args() conf = GameConf() conf.solver_name = dict_solver[args.s] conf.mode = dict_mode[args.m] print("Solver: %s Mode: %s" % (conf.solver_name, conf.mode)) Game(conf).run()