Exemplo n.º 1
0
 @Override
 public String toString() {
   StringBuilder sb = new StringBuilder();
   for (Tile t : this.map.values()) {
     sb.append("x: " + t.getPoint().x);
     sb.append("y: " + t.getPoint().y);
     sb.append(" obs: " + t.isObstacle());
     sb.append(" dirty: " + t.isDirty());
     sb.append(" base: " + t.isBase());
     sb.append("\n");
   }
   return sb.toString();
 }
Exemplo n.º 2
0
  private void updateMinMax(Tile t) {
    if (t.isObstacle()) return;

    if (!rowsWallsDetected) {
      if (t.getPoint().x < minX) minX = t.getPoint().x;
      if (t.getPoint().x > maxX) maxX = t.getPoint().x;
    }
    if (!colsWallsDetected) {
      if (t.getPoint().y < minY) minY = t.getPoint().y;

      if (t.getPoint().y > maxY) maxY = t.getPoint().y;
    }
  }
Exemplo n.º 3
0
 public boolean isVisited(Tile t) {
   return this.map.containsKey(t.getPoint());
 }
Exemplo n.º 4
0
  public void setTile(Tile t) {
    updateMinMax(t);

    /* TODO check, will hashCode of points works? */
    this.map.put(t.getPoint(), t);
  }
Exemplo n.º 5
0
  public boolean isWall(Tile t) {
    if (this.isVisited(t)) return this.map.get(t.getPoint()).isWall();

    return false;
  }