bot
Class Bot

java.lang.Object
  extended bybot.Bot
Direct Known Subclasses:
AcidCrossBot, BabyBot1, BabyBot2, BabyBot3, BabyBot4, CollectorBot, CommandoBot, CountingKeysBot, Crawler, CrossBot, DancerBotA, DeadlyPlusBot, Deep, DoorBot, DumbBot, EchoBot, ErrorBot, FaultyBot, GiftBot, HammerChargeBot, HammerRoomBot, HelloBot, HumanBot, IslandHopperBot, LazyBot, LonePillarBot, LongWalkABot, LooperBot, MapNavigator, MapNavigator.nav_bot, MarkerBot, MarkerChainBot, MarkerTestBot, MeltingPathBot, OrbJumperBot, PS2BBot, PS2Bot, RandomBot, ReaderBot, SecretDoorBot, SimpleBot, SnifferBot, SonarBot, SpiralBot, SuitcaseBot, SuperSnifferBot, TakeARightBot, TicklishBot, TwistedHallBot, TypewriterBot, WallBot, WidgetBot, WinderBot

public abstract class Bot
extends Object

This is the basic Bot class. It is a primitive bot which does not do anything and needs to, in order to wander the maze.

It has the following basic methods of interest:
step()
turn()
Thing feel()
Thing grab()
say( String )


Field Summary
protected  BotBoard board
          The BotBoard is the interface between the Bot and the actual Board maze.
 
Constructor Summary
Bot()
          Build a bot.
 
Method Summary
abstract  void compute()
          This is what the system runs so the bot can run around the maze.
 void drop(Thing t)
          ACTION: Drop a thing in the square I am standing on.
 Thing feel()
          ACTION: Feel in direction bot is facing.
 boolean feelKey()
          ACTION: This returns true if the bot feels a key right in front of it.
 boolean feelPit()
          ACTION: This returns true if the bot feels a pit right in front of it.
 boolean feelWall()
          ACTION: This returns true if the bot is facing a wall.
 Board getBoard()
           
 BotBoard getBotBoard()
           
 int getHeading()
          Bots are always facing one of the cardinal directions.
 Informer getInformer()
          Get the interface for the bot
 String getInput()
          ACTION: Get input from the human.
 char getInputCharacter()
          Get single character of input from human (as soon as possible, no blocking.)
 int getIntFromHuman()
          ACTION: Get an integer from the human.
 Point getLocation()
          Return where bot is.
 String getStringFromHuman()
          ACTION: Get a string from the human.
 Thing grab()
          ACTION: Grabs the thing in front of bot.
 void left()
          ACTION: Turn left 90 degrees.
 void place(Thing t)
          ACTION: Place a thing in the square in front of me.
 void rest()
          ACTION: Take a small nap.
 void right()
          ACTION: Turn right 90 degrees.
 void say(boolean b)
           
 void say(double f)
           
 void say(int v)
           
 void say(Object t)
          ACTION: Say the passed object.
 void say(String s)
          ACTION: Say the string.
 void setAppearance(String toWhat)
          Change what bot looks like!
 void step()
          ACTION: Take a single step in the current direction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

board

protected BotBoard board
The BotBoard is the interface between the Bot and the actual Board maze.

Constructor Detail

Bot

public Bot()
Build a bot. The constructor does nothing special.

Method Detail

getInformer

public Informer getInformer()
Get the interface for the bot


getBoard

public Board getBoard()
Returns:
the Board the bot is currently on.

getBotBoard

public BotBoard getBotBoard()
Returns:
the BotBoard the bot is currently on.

rest

public void rest()
ACTION: Take a small nap.


step

public void step()
          throws BotException
ACTION: Take a single step in the current direction.

Throws:
BotException

getHeading

public int getHeading()
Bots are always facing one of the cardinal directions.

Returns:
current direction (See Heading class for what numbers corrispond to what directions.

right

public void right()
ACTION: Turn right 90 degrees.


left

public void left()
ACTION: Turn left 90 degrees.


feel

public Thing feel()
ACTION: Feel in direction bot is facing. Does not feel board's actors.

Returns:
the Thing felt by bot. If there is nothing there, returns null. If there is a wall, return a wall object. These objects are _not_ taken.

grab

public Thing grab()
           throws BotException
ACTION: Grabs the thing in front of bot. Will crash if there is nothing, or if there is a wall.

Throws:
BotException

place

public void place(Thing t)
           throws BotException
ACTION: Place a thing in the square in front of me.

Parameters:
t - The object to put down.
Throws:
BotException

drop

public void drop(Thing t)
          throws BotException
ACTION: Drop a thing in the square I am standing on.

Parameters:
t - The object to put down.
Throws:
BotException

say

public void say(String s)
ACTION: Say the string.

Parameters:
s - The string to say.

say

public void say(Object t)
ACTION: Say the passed object. (Invokes toString on the Object.)

Parameters:
t - The thing to say.

say

public void say(int v)

say

public void say(double f)

say

public void say(boolean b)

getLocation

public Point getLocation()
Return where bot is.

Returns:
A Point with (x,y) corrisponding to the Bot's location on the board.

feelWall

public boolean feelWall()
ACTION: This returns true if the bot is facing a wall.

Returns:
true if wall felt, false otherwise.

feelKey

public boolean feelKey()
ACTION: This returns true if the bot feels a key right in front of it.

Returns:
true if key felt, false otherwise.

feelPit

public boolean feelPit()
ACTION: This returns true if the bot feels a pit right in front of it.

Returns:
true if pit felt, false otherwise.

getStringFromHuman

public String getStringFromHuman()
ACTION: Get a string from the human. They type and then hit return, bot gets string they typed.

Returns:
The String the human typed in.

getIntFromHuman

public int getIntFromHuman()
ACTION: Get an integer from the human. They type and then hit return, bot gets string they typed. If the string is not an int, it asks again.

Returns:
The String the human typed in.

getInput

public String getInput()
ACTION: Get input from the human.

Returns:
All typed-in input (as string).

getInputCharacter

public char getInputCharacter()
Get single character of input from human (as soon as possible, no blocking.)


setAppearance

public void setAppearance(String toWhat)
Change what bot looks like!

Parameters:
toWhat - is a name of an image file.

compute

public abstract void compute()
This is what the system runs so the bot can run around the maze.

All bots need to implement this method so they can do stuff.