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