From 8e894dcc981b7e32ac175e695923476ac810db3c Mon Sep 17 00:00:00 2001 From: fdai7793 Date: Sat, 3 Feb 2024 18:10:16 +0100 Subject: [PATCH] addCheckForWinner --- src/main/java/de/hsfulda/onses/services/GameService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/de/hsfulda/onses/services/GameService.java b/src/main/java/de/hsfulda/onses/services/GameService.java index 5600b04..b21c590 100644 --- a/src/main/java/de/hsfulda/onses/services/GameService.java +++ b/src/main/java/de/hsfulda/onses/services/GameService.java @@ -89,6 +89,11 @@ public class GameService { drawCard(2); 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"); + } } public boolean legalMove(Card card) {