Skip to content

Commit

Permalink
Fix: Use getPlayerSymbol to get the player symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
JonBergland committed Feb 2, 2024
1 parent 9995219 commit b593757
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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++) {
Expand Down

0 comments on commit b593757

Please sign in to comment.