- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WP - - - - - - -
package chessPieces; public class Pawn extends ChessPiece{ char color; public Pawn(char color) { this.color = color; } }
package board; import java.util.ArrayList; import chessPieces.ChessPiece; import chessPieces.EmptySpace; import chessPieces.Pawn; public class BoardInterface { static char white = 'W'; static char black = 'B'; static char empty = '-'; ChessPiece[][] board; int turn; ArrayList<int[][]> previousMoves; public BoardInterface() { this.turn = 0; this.board = new ChessPiece[8][8]; for(int i = 0; i < 7; i++) { for(int j = 0; j < 8; j++) { board[i][j] = new EmptySpace(empty); } } this.board[7][0] = new Pawn(white); } }
package chessPieces; public class EmptySpace extends ChessPiece { char color; public EmptySpace(char color) { this.color = color; } }
ChessPiece
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)