示例#1
0
        public override GameState execute(GameState gs)
        {
            Player player = gs.currentPlayer();
            int cardsRemoved = 0;

            foreach (City card in player.cards)
            {
                if (cardsRemoved == 5 || (cardsRemoved == 4 && gs.currentPlayer().type == Player.Type.SCIENTIST)) break;
                if (color == card.color)
                {
                    player = player.removeCard(card);
                    cardsRemoved++;
                }
            }
            GameState result = gs.cureDisease(color);
            result = result.adjustPlayer(player);
            result.advanceMove();
            result = result.recalcBestCardHolder(result, gs.currentPlayer(), color);
            return result;

        }
示例#2
0
        public override GameState execute(GameState gs)
        {
            Player player       = gs.currentPlayer();
            int    cardsRemoved = 0;

            foreach (City card in player.cards)
            {
                if (cardsRemoved == 5 || (cardsRemoved == 4 && gs.currentPlayer().type == Player.Type.SCIENTIST))
                {
                    break;
                }
                if (color == card.color)
                {
                    player = player.removeCard(card);
                    cardsRemoved++;
                }
            }
            GameState result = gs.cureDisease(color);

            result = result.adjustPlayer(player);
            result.advanceMove();
            result = result.recalcBestCardHolder(result, gs.currentPlayer(), color);
            return(result);
        }
示例#3
0
        public void TestWin()
        {
            gs = gs.cureDisease(DiseaseColor.BLUE);
            gs = gs.cureDisease(DiseaseColor.YELLOW);
            gs = gs.cureDisease(DiseaseColor.ORANGE);
            Assert.IsFalse(gs.hasWon());
            gs = gs.cureDisease(DiseaseColor.BLACK);
            Assert.IsTrue(gs.hasWon());

        }