Advertisement
umar_ahmad

pawn.java

Feb 28th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. package chess;
  2.  
  3. public class Pawn extends Piece{
  4. public Pawn(PieceColour colour){
  5. this.colour = colour;
  6. if (colour == PieceColour.WHITE){
  7. setSymbol("wp");
  8. }
  9. else {
  10. setSymbol("bp");
  11. }
  12. }
  13.  
  14. public boolean isLegitMove(int iIn, int jIn, int iOut, int jOut){
  15. // Board b = new Board();
  16. if (iOut == iIn+1 && jOut == jIn){
  17. return true;
  18. }
  19. // else if (iOut == iIn+1 && jOut == jIn+1 && b.hasPiece() == true){
  20. // return true;
  21. // }
  22. // else if (iOut == iIn+1 && jOut == jIn-1 && b.hasPiece() == true){
  23. // return true;
  24. // }
  25. else {
  26. return false;
  27. }
  28. // return false;
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement