예제 #1
0
        static void Main(string[] args)
        {
            var controller = new RealController();
            var evaluator = new SnakeEvaluatorTwo();
            var strategy = new TreeStrategy(evaluator, 100);
            var logger = new GameLogger();

            playGame(controller, strategy, logger);

            logger.output();
        }
예제 #2
0
 private static void playGame(Controller controller, Strategy strategy, GameLogger logger)
 {
     while (true)
     {
         try
         {
             var board = controller.getBoard();
             logger.append(board);
             var move = strategy.getDirection(board);
             if (move != Direction.None)
             {
                 controller.move(move);
             }
             else
             {
                 break;
             }
         }
         catch (StaleElementReferenceException)
         {
             System.Threading.Thread.Sleep(100);
         }
     }
 }