Class BotWorld

java.lang.Object
  extended by BotWorld

public class BotWorld
extends Object


Constructor Summary
BotWorld()
          Create a new BotWorld, with a view and default dots/walls.
 
Method Summary
 boolean addDot(int x, int y)
          Add a dot at the given coordinates.
 boolean addWall(int x, int y)
          Create a wall at the given coordinates.
 boolean addWall(int x, int y, char dir, int n)
          Create a wall from the given coordinate (inclusive) extending n spaces in the given direction (for a total of n wall segments).
 void clearCells()
          Clear the cells in this BotWorld.
 boolean hasDot(int x, int y)
          Return whether there is a dot at the given coordinate.
 boolean isWall(int x, int y)
          Find out whether (true) or not (false) there is a wall at the given coordinates.
 boolean removeDot(int x, int y)
          Try to remove a dot from the given coordinates.
 boolean removeWall(int x, int y)
          Remove the wall at the given location, if it exists.
 void updateView()
          Allow an external class to request a view update.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BotWorld

public BotWorld()
Create a new BotWorld, with a view and default dots/walls.

Method Detail

addDot

public boolean addDot(int x,
                      int y)
Add a dot at the given coordinates.

Returns:
true if the addition was successful, false otherwise

addWall

public boolean addWall(int x,
                       int y)
Create a wall at the given coordinates.

Returns:
true if a wall was created, false otherwise

addWall

public boolean addWall(int x,
                       int y,
                       char dir,
                       int n)
Create a wall from the given coordinate (inclusive) extending n spaces in the given direction (for a total of n wall segments).

Parameters:
x - the x coordinate of the start of the wall
y - the y coordinate of the start of the wall
dir - the direction in which to extend from the start coordinates, one of 'n', 'e', 's', or 'w'
n - the number of wall segments to create
Returns:
true (if the creation was successful, false otherwise)

clearCells

public void clearCells()
Clear the cells in this BotWorld. (Bots are unaffected.)


hasDot

public boolean hasDot(int x,
                      int y)
Return whether there is a dot at the given coordinate.


isWall

public boolean isWall(int x,
                      int y)
Find out whether (true) or not (false) there is a wall at the given coordinates.

Returns:
true if the given coordinates are at a wall, false otherwise

removeDot

public boolean removeDot(int x,
                         int y)
Try to remove a dot from the given coordinates. Return true if successful, false if there was no dot to remove.


removeWall

public boolean removeWall(int x,
                          int y)
Remove the wall at the given location, if it exists.

Returns:
true if a wall was removed, false otherwise

updateView

public void updateView()
Allow an external class to request a view update.