示例#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();
            }


        }
示例#2
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();
            }
        }
示例#3
0
 public void TestLoseNoCards()
 {
     gs = new GameState(atlanta, map, 1, 4, null, new Deck<City>(map.allCities, true, false));
     gs = gs.drawPlayerCards(gs.currentPlayer(), 1);
     Assert.IsFalse(gs.hasLost());
     gs = gs.drawPlayerCards(gs.currentPlayer(), 2);
     Assert.IsTrue(gs.hasLost());
 }
示例#4
0
 public void TestLoseOutbreak()
 {
     map = new Map();
     atlanta = map.addCity("Atlanta", DiseaseColor.BLUE);
     gs = new GameState(atlanta, map, 1, 4, new Deck<City>(map.allCities), new Deck<City>(map.allCities));
     gs = new GameState(gs, gs.map.addDisease(atlanta, 3));
     Assert.AreEqual(0, gs.map.outbreakCount);
     gs = new GameState(gs, gs.map.addDisease(atlanta, 1));
     Assert.AreEqual(1, gs.map.outbreakCount);
     Assert.IsFalse(gs.hasLost());
     for (int i = 0; i < 7; i++)
     {
         gs = new GameState(gs, gs.map.addDisease(atlanta, 1));
     }
     Assert.AreEqual(8, gs.map.outbreakCount);
     Assert.IsFalse(gs.hasLost());
     gs = new GameState(gs, gs.map.addDisease(atlanta, 1));
     Assert.AreEqual(9, gs.map.outbreakCount);
     Assert.IsTrue(gs.hasLost());
 }