Class Obstacle

java.lang.Object
za.co.wethinkcode.robots.server.world.Obstacle
All Implemented Interfaces:
Iterable<Position>, WorldObject
Direct Known Subclasses:
MineObstacle, PitObstacle

public class Obstacle extends Object implements Iterable<Position>, WorldObject
  • Constructor Details

  • Method Details

    • addObstacle

      public void addObstacle(Position pos)
    • hasObstacle

      public boolean hasObstacle(Position pos)
    • getAll

      public List<Position> getAll()
    • clear

      public void clear()
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • iterator

      public Iterator<Position> iterator()
      Specified by:
      iterator in interface Iterable<Position>
    • loadObstaclesFromPattern

      public void loadObstaclesFromPattern(int type)
    • getTopLeft

      public Position getTopLeft()
    • getBottomRight

      public Position getBottomRight()
    • blocksSightline

      public boolean blocksSightline()
      This check returns if the WorldObject in question blocks the sightline

      Useful for the LookCommand

      Specified by:
      blocksSightline in interface WorldObject
      Returns:
      if a world object blocks the sightline, and prevents other objects from being seen beyond it
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSymbol

      public String getSymbol()
      Specified by:
      getSymbol in interface WorldObject