Guest User

Emptyspace

a guest
Jun 19th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1.   import java.util.*;
  2.    
  3.    public class EmptySpace extends Location {
  4.  
  5.       private Dot dot;
  6.       int r, c;
  7.  
  8.       boolean occupied;
  9.      
  10.     /*int red = Math.abs(locRed.getR() - r) + Math.abs(locRed.getC() - c);
  11.     int blue = Math.abs(locBlue.getR() - r) + Math.abs(locBlue.getC() - c);
  12.     int pink = Math.abs(locPink.getR() - r) + Math.abs(locPink.getC() - c);
  13.     int orange = Math.abs(locOrange.getR() - r) + Math.abs(locOrange.getC() - c); */
  14.  
  15.     public int compareTo (Location other) {return 0; }
  16.    
  17.  
  18.       public EmptySpace (int r, int c) {
  19.         super(r,c);
  20.         dot = new Dot (false, false);
  21.         occupied = false;
  22.        
  23.       }
  24.  
  25.       public boolean isValid () {
  26.         return r >= 0 && r <= 36 && c >= 0 && c <= 28 && !occupied;
  27.       }
  28.  
  29.  
  30.      public boolean hasDot() {
  31.     return !dot.isNull();
  32.       }
  33.  
  34.       public Dot getDot () {
  35.     return dot;
  36.       }
  37.      
  38.    
  39.       public void setDot(Dot d) {
  40.         dot = d;
  41.       }
  42.   }
Advertisement
Add Comment
Please, Sign In to add comment