Advertisement
faredx

King.java

Feb 28th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. package chess;
  2. import java.lang.Math;
  3.  
  4. public class King extends Piece{
  5. public King(PieceColour inColour) {
  6. colour = inColour;
  7. if (inColour==PieceColour.BLACK)
  8. super.setSymbol("\u265A");
  9. else
  10. super.setSymbol("\u2654");
  11. }
  12.  
  13. @Override
  14. public boolean isLegitMove(int inRow1, int inColumn1, int inRow2, int inColumn2) {
  15. boolean legit = false;
  16. if ((Math.abs(inRow2-inRow1) <= 1) && (Math.abs(inColumn2-inColumn1) <=1)) {
  17. legit = true;
  18. }
  19. return legit;
  20. }
  21.  
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement