From 3fe51e66527d33dca14ef29877db013958e0e920 Mon Sep 17 00:00:00 2001 From: Jerome Bedier Date: Fri, 18 Apr 2025 17:31:44 +0200 Subject: [PATCH] normally rhe code should work to see display modify this : public ArrayList getPieces() { ArrayList pieces = new ArrayList<>(); //TODO return pieces; } --- src/backend/Board.java | 6 ++++-- src/backend/Piece.java | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/backend/Board.java b/src/backend/Board.java index b43543e..6cfb27b 100644 --- a/src/backend/Board.java +++ b/src/backend/Board.java @@ -16,12 +16,12 @@ public class Board { } public int getWidth() { - width = 8; // setting the width at 8 for the moment can be changed + //width = 8; // setting the width at 8 for the moment can be changed return width; } public int getHeight() { - height = 8; // setting the height at 8 for the moment can be changed + //height = 8; // setting the height at 8 for the moment can be changed return height; } @@ -43,6 +43,8 @@ public class Board { } public void populateBoard() { + + board[0][0] = new Piece(false, PieceType.Rook, 0, 0); /* // Place Rooks board[0][0] = new Rook(PieceColor.BLACK, new Position(0, 0)); diff --git a/src/backend/Piece.java b/src/backend/Piece.java index 038268b..defbb68 100644 --- a/src/backend/Piece.java +++ b/src/backend/Piece.java @@ -6,6 +6,13 @@ public class Piece { int y; private PieceType type; + public Piece(boolean whitePiece, PieceType type, int x, int y) { + this.whitePiece = whitePiece; + this.type = type; + this.x = x; + this.y = y; + } + public int getX() { return x; }