From b01ceb96f57b842542ca742e0db32736b4fe8775 Mon Sep 17 00:00:00 2001 From: Lucie Date: Thu, 24 Apr 2025 20:58:59 +0200 Subject: [PATCH] end of part 1 --- src/backend/Board.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/backend/Board.java b/src/backend/Board.java index 6154b67..5072436 100644 --- a/src/backend/Board.java +++ b/src/backend/Board.java @@ -9,6 +9,8 @@ public class Board { private Piece[][] board; private int x; private int y; + private int turns; + private boolean whiteTurn; public Board(int colNum, int lineNum) { this.colNum = colNum; @@ -16,6 +18,8 @@ public class Board { this.board = new Piece[lineNum][colNum]; x = -1; y = -1; + turns = 0; + whiteTurn = true; } public int getWidth() { @@ -27,13 +31,11 @@ public class Board { } public int getTurnNumber() { - //TODO - return 0; + return turns; } public boolean isTurnWhite() { - //TODO - return false; + return whiteTurn; } public void setPiece(boolean isWhite, PieceType type, int x, int y) { @@ -147,8 +149,15 @@ public class Board { board[this.y][this.x].setY(y); board[y][x] = board[this.y][this.x]; board[this.y][this.x] = null; + turns += 1; this.x = -1; this.y = -1; + if (whiteTurn == true) { + whiteTurn = false; + } + else { + whiteTurn = true; + } } } else {