Exemple #1
0
        public void runAction()
        {
            Action a;

            if (gs.currentPlayer().isAI)
            {
                a = ev.bfs_findbest(gs, 9);
            }
            else
            {
                ActionChooser foo = new ActionChooser(gs.availableActions());
                foo.ShowDialog();
                a = foo.selection;
            }
            lastAction = a;
            gs         = a.execute(gs);

            if (gs.hasEpidemic)
            {
                gs.hasEpidemic = false;
                MessageBox.Show("Epidemic Occured!");
            }

            //throw up some GUI
            if (gs.hasLost())
            {
                MessageBox.Show("You Lost");
                Application.Exit();
            }

            if (gs.hasWon())
            {
                MessageBox.Show("You Won");
                Application.Exit();
            }
        }
 public GameState doSteps(GameState initial, SearchEvaluate eval, int steps, int depth)
 {
     GameState current = initial;
     for (int i = 0; i < steps; i++)
     {
         Action move = eval.bfs_findbest(current, depth);
         current = move.execute(current);
     }
     return current;
 }