ants.move.bot
Class Bot

java.lang.Object
  |
  +--ants.move.bot.Bot
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
GuideBot, RunnerBot

public class Bot
extends java.lang.Object
implements java.lang.Runnable

Implementation of MOVE! Bot.

Version:
1.0 Build 2002
Author:
Carles Pairot (cpairot@tinet.org), Oriol Montalā (omontala@tinet.org), Francesc Piņas(fpd@tinet.org)

Constructor Summary
Bot(java.lang.String name, java.lang.String avatar)
          Bot's constructor.
 
Method Summary
 void ai()
          Bot's artificial intelligence (all the movements of bot)
 java.lang.String getName()
          Returns the bot's name.
 float getOrientation()
          Returns the current orientation of bot.
 ants.core.Place getPlace()
          Returns the current place where bot's joined.
 float[] getPosition()
          Returns the current position of bot.
 void go(float[] position)
          teleports bot to a new position
 void joinToPlace(java.lang.String host, java.lang.String worldKey, java.lang.String placeKey)
          Joins bot to place.
 void leavePlace()
          Bot leaves the current place
 void move(float meters)
          Move bot from his current position to another position, in the direction of his orientation
 void run()
           
 void setOrientation(float ori)
          Sets a new orientation for the bot.
 void setPosition(float[] pos)
          Sets a new position for the bot.
 void talk(java.lang.String msg)
          Bot sends a message to all users in this place
 void turnLeft()
          Bot turns to left
 void turnRight()
          Bot turns to right
 void wait(int millis)
          Bot sleeps a number of milliseconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bot

public Bot(java.lang.String name,
           java.lang.String avatar)
Bot's constructor.
Parameters:
name - Bot's name
avatar - Bot's avatar representation
Method Detail

setPosition

public void setPosition(float[] pos)
Sets a new position for the bot.
Parameters:
pos - position

setOrientation

public void setOrientation(float ori)
Sets a new orientation for the bot.
Parameters:
ori - orientation

getPlace

public ants.core.Place getPlace()
Returns the current place where bot's joined.
Returns:
place

getName

public java.lang.String getName()
Returns the bot's name.
Returns:
name

getPosition

public float[] getPosition()
Returns the current position of bot.
Returns:
position

getOrientation

public float getOrientation()
Returns the current orientation of bot.
Returns:
orientation

joinToPlace

public void joinToPlace(java.lang.String host,
                        java.lang.String worldKey,
                        java.lang.String placeKey)
                 throws java.lang.Exception
Joins bot to place.
Parameters:
host - MOVE! host
worldKey - world's key
placeKey - place's key

move

public void move(float meters)
Move bot from his current position to another position, in the direction of his orientation
Parameters:
meters - number of meters to move

go

public void go(float[] position)
teleports bot to a new position
Parameters:
position - new position of bot

turnLeft

public void turnLeft()
Bot turns to left

turnRight

public void turnRight()
Bot turns to right

wait

public void wait(int millis)
Bot sleeps a number of milliseconds
Parameters:
millis - milliseconds

talk

public void talk(java.lang.String msg)
Bot sends a message to all users in this place
Parameters:
msg - message

leavePlace

public void leavePlace()
Bot leaves the current place

run

public final void run()
Specified by:
run in interface java.lang.Runnable

ai

public void ai()
Bot's artificial intelligence (all the movements of bot)


Developers: Oriol Montala, Carles Pairot, Francesc Pinas2000 - 2002
Departament d'Enginyeria Informatica i Matematiques
Escola Tecnica Superior d'Enginyeria
Universitat Rovira i Virgili