|
@ -59,6 +59,14 @@ public class GameService { |
|
|
game.changeLastPlayedCardColor(color); |
|
|
game.changeLastPlayedCardColor(color); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void checkForWin() { |
|
|
|
|
|
if (this.game.getPlayerService().getPlayerList().getFirst().getPlayerDeck().isEmpty()) { |
|
|
|
|
|
System.out.println("Player wins"); |
|
|
|
|
|
} else if (this.game.getPlayerService().getPlayerList().getLast().getPlayerDeck().isEmpty()) { |
|
|
|
|
|
System.out.println("Bot wins"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void playCard(Card card) { |
|
|
public void playCard(Card card) { |
|
|
// add lastPlayedCard back to drawCardDeck |
|
|
// add lastPlayedCard back to drawCardDeck |
|
|
this.addLastPlayedCardToDrawCardDeck(); |
|
|
this.addLastPlayedCardToDrawCardDeck(); |
|
@ -89,11 +97,7 @@ public class GameService { |
|
|
drawCard(2); |
|
|
drawCard(2); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
if (this.game.getPlayerService().getPlayerList().getFirst().getPlayerDeck().isEmpty()) { |
|
|
|
|
|
System.out.println("Player wins"); |
|
|
|
|
|
} else if (this.game.getPlayerService().getPlayerList().getLast().getPlayerDeck().isEmpty()) { |
|
|
|
|
|
System.out.println("Bot wins"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
checkForWin(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public boolean legalMove(Card card) { |
|
|
public boolean legalMove(Card card) { |
|
|