All pastes #428128 Raw Edit

Unnamed

public java v1 · immutable
·published 2007-04-07 09:06 UTC
rendered paste body
package chess.christopherWachowicz;import chess.spec.*;public class Pawn extends Piece {	public Pawn(String descriptor, Player color) {		super(descriptor, color);		// TODO Auto-generated constructor stub	}		public boolean canMove(Topology topology, Square[] squares, Square from, Square to){		boolean outcome = false;				Square[] adjacent;		adjacent = topology.getAdjacentSquares(squares, from);						if(from.occupyingPiece.color() == Piece.Player.BLACK){			if(adjacent[DOWN] == to && to.isOccupied == false){				outcome = true;			}			else if(adjacent[DOWN_RIGHT] == to && to.isOccupied == true && to.occupyingPiece.color() == Piece.Player.WHITE){				outcome = true;			}			else if(adjacent[DOWN_LEFT] == to && to.isOccupied == true && to.occupyingPiece.color() == Piece.Player.WHITE){				outcome = true;			}		} else {			if(adjacent[UP] == to && to.isOccupied == false){				outcome = true;			}			else if(adjacent[UP_LEFT] == to && to.isOccupied == true && to.occupyingPiece.color()  == Piece.Player.BLACK){				outcome = true;			}			else if(adjacent[UP_RIGHT] == to && to.isOccupied == true && to.occupyingPiece.color()  == Piece.Player.BLACK){				outcome = true;			}					}				return outcome;	}	}