From b5937572195c56f4f46254e8214adbaf7ebf541b Mon Sep 17 00:00:00 2001 From: Jon Bergland Date: Fri, 2 Feb 2024 17:36:50 +0100 Subject: [PATCH] Fix: Use getPlayerSymbol to get the player symbol --- .../board/master/model/games/connect_four/ConnectFour.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/board/master/model/games/connect_four/ConnectFour.java b/backend/src/main/java/board/master/model/games/connect_four/ConnectFour.java index 6551650..2019507 100644 --- a/backend/src/main/java/board/master/model/games/connect_four/ConnectFour.java +++ b/backend/src/main/java/board/master/model/games/connect_four/ConnectFour.java @@ -1,9 +1,7 @@ package board.master.model.games.connect_four; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import board.master.model.Action; import board.master.model.StateHandler; @@ -99,7 +97,7 @@ private boolean checkHorizontalWin(int player) { } private boolean checkVerticalWin(int player) { - String playerSymbol = Integer.toString(player); + String playerSymbol = getPlayerSymbol(player); for (int col = 0; col < columnHeight; col++) { for (int row = 0; row < rowLength - 3; row++) { if (board.getPosition(row, col).equals(playerSymbol) @@ -114,7 +112,7 @@ private boolean checkVerticalWin(int player) { } private boolean checkDiagonalWin(int player) { - String playerSymbol = Integer.toString(player); + String playerSymbol = getPlayerSymbol(player); // Check diagonal (top-left to bottom-right) for (int row = 0; row < rowLength - 3; row++) { for (int col = 0; col < columnHeight - 3; col++) {