Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. // A class representing a position in the game
  2.  
  3. public class Position {
  4. private int row;
  5. private int col;
  6.  
  7. public Position(int row, int col) {
  8. this.row = row;
  9. this.col = col;
  10. }
  11.  
  12. public int getRow() {
  13. return row;
  14. }
  15.  
  16. public int getCol() {
  17. return col;
  18. }
  19.  
  20. public boolean equals(Position otherLoc) {
  21. return row == otherLoc.getRow() && col == otherLoc.getCol();
  22. }
  23.  
  24. public String toString() {
  25. return "(" + row + ", " + col + ")";
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement