diff --git a/src/model/Board.java b/src/model/Board.java index 3325239..46f658a 100755 --- a/src/model/Board.java +++ b/src/model/Board.java @@ -213,65 +213,7 @@ public ArrayList generateRegularMovesForPiece(Piece p) { return avail_moves; } - /** -<<<<<<< HEAD -======= - * Generates the frontier for movement for all pieces. - * @param color - * @return - */ - public ArrayList generateMoveFrontier(Color color) { - ArrayList frontier = new ArrayList(); - for (int i = 0; i < BOARD_SIZE; ++i) { - for (int j = 0; j < BOARD_SIZE; ++j) { - Piece p = this.representation[i][j]; - if(null != p && p.getColor() == color) { - ArrayList moves = generateMoves(this.representation[i][j]); - for (Move move : moves) { - Board board = new Board(this); - board.move(move); - frontier.add(board); - } - } - } - } - return frontier; - } - - public void move(Move move) { - representation[move.destination.row][move.destination.column] - = representation[move.source.row][move.source.column]; - representation[move.source.row][move.source.column] = null; - representation[move.destination.row][move.destination.column] - .setLocation(new Location(move.destination.row, move.destination.column)); - Piece moved = representation[move.destination.row][move.destination.column]; - this.lastPieceMoved = moved; - this.lastMove = move; - } - - /** - * Move the jumper and erase the jumpee. - * @param jump - */ - public void jump(Move jump) { - representation - [(jump.destination.row + jump.source.row)/2] - [(jump.destination.column + jump.source.column)/2] = null; // monkey - representation[jump.destination.row][jump.destination.column] = - representation[jump.source.row][jump.source.column]; - representation[jump.source.row][jump.source.column] = null; - representation[jump.destination.row][jump.destination.column] - .setLocation(new Location(jump.destination.row, jump.destination.column)); - - Piece moved = representation[jump.destination.row][jump.destination.column]; - this.lastPieceMoved = moved; - this.lastMove = jump; - this.resetMovesSinceCapture(); - - } - - /** ->>>>>>> 430f2be346c625bc746ce1659838d93253901c11 + /** * Returns the possible jumps a piece can take. * @param color * @return diff --git a/src/view/GameEventListener.java b/src/view/GameEventListener.java index 6bd334f..02141eb 100644 --- a/src/view/GameEventListener.java +++ b/src/view/GameEventListener.java @@ -60,14 +60,7 @@ public void keyPressed(KeyEvent arg0) {} @Override public void keyReleased(KeyEvent e) { -<<<<<<< HEAD -======= - if(e.getKeyCode() == KeyEvent.VK_ENTER && gamePanel.moveReady()) { - gamePanel.moveSelectedPiece(); - gamePanel.updateMoveMessage(); - } ->>>>>>> 430f2be346c625bc746ce1659838d93253901c11 } @Override diff --git a/src/view/GamePanel.java b/src/view/GamePanel.java index fa012f1..514f0dd 100644 --- a/src/view/GamePanel.java +++ b/src/view/GamePanel.java @@ -7,20 +7,12 @@ import javax.swing.JLabel; import javax.swing.JPanel; -<<<<<<< HEAD import controller.Game; import controller.GameConstants; import model.Color; import model.Location; import model.Move; -import model.Piece; -import model.Type; -======= -import model.Color; -import model.Location; -import model.Move; -import controller.Game; ->>>>>>> 430f2be346c625bc746ce1659838d93253901c11 + /** * Represents the panel which will hold all of the graphical @@ -130,8 +122,7 @@ public void highlightValidDestinations(Location source) { public void dehighlightValidDestinations() { canvas.invalidateAllSquares(); } - -<<<<<<< HEAD + public void movePiece(Move move) { if (move.isJump()) { int monkeyRow = (move.destination.row + move.source.row)/2; @@ -146,19 +137,11 @@ public void movePiece(Move move) { if (canPromote(canvas.getSquare(move.destination))) { canvas.getSquare(move.destination).promotePiece(); } -======= - public Location getMoveSource(){ - return moveSource.getCellLocation(); - } - - public Location getMoveDestination(){ - return moveDestination.getCellLocation(); ->>>>>>> 430f2be346c625bc746ce1659838d93253901c11 } public void moveSelectedPiece() { -<<<<<<< HEAD + /* Create the move */ Move move = new Move(moveSource.getCellLocation(), moveDestination.getCellLocation()); @@ -197,33 +180,6 @@ public void resetMove() { moveDestination.setSelected(false); moveSource = null; moveDestination = null; -======= - Move move = new Move(getMoveSource(), getMoveDestination()); - game.movePiece(move); - - canvas.moveChecker(getMoveSource(), getMoveDestination()); - dehighlightAllSquares(); - - if(move.isJump()) { - Location monkeyLoc = new Location((move.destination.row - + move.source.row)/2, - (move.source.column - + move.destination.column) / 2); - System.out.println(monkeyLoc); - removePiece(monkeyLoc); - moveSource.setSelected(false); - //moveDestination.setSelected(false); - moveSource = null; - //moveDestination = null; - - } else { - moveSource.setSelected(false); - moveDestination.setSelected(false); - moveSource = null; - moveDestination = null; - game.switchTurn(); - } ->>>>>>> 430f2be346c625bc746ce1659838d93253901c11 } public boolean canPromote(Square square) { diff --git a/src/view/Square.java b/src/view/Square.java index 2c4b197..d4d2e3e 100644 --- a/src/view/Square.java +++ b/src/view/Square.java @@ -184,8 +184,6 @@ public void dehighlight() { public Color getPieceColor() { return pieceColor; } -<<<<<<< HEAD - public void placePiece(Color color) { this.hasPiece = true; @@ -200,11 +198,6 @@ public Color removePiece() { return color; } -======= - - public void dehighlight() { - this.setBorder(null); ->>>>>>> 430f2be346c625bc746ce1659838d93253901c11 public void setKing(boolean king) { this.king = king;