|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Vroomba RandomVroomba
public class RandomVroomba
This Vroomba doesn't even look at its surroundings; it just moves in a random direction each turn, even if this will result in a collision or drop. However, it never chooses Direction.HERE, and so it will never stop of its own accord.
Vroomba
Constructor Summary | |
---|---|
RandomVroomba()
|
Method Summary | |
---|---|
Direction |
move(char[] s)
Provides this Vroomba its current surroundings and asks it to choose a direction to move. |
Methods inherited from class Vroomba |
---|
reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomVroomba()
Method Detail |
---|
public Direction move(char[] s)
Vroomba
The surroundings should contain 8 entries, for
surroundings[Direction.N.ordinal()],
surroundings[Direction.NE.ordinal()], surroundings[Direction.E.ordinal()],
... surroundings[Direction.NW.ordinal()]
.
Each character contained should be a valid feature of a Room.
This Vroomba will then return the Direction it would like to move. If it no longer wishes to move (usually because it believes its containing Room is clean), it may return Direction.HERE to stop.
This behavior will depend on the overriding performed by any specific, extending Vroomba. This default Vroomba always returns Direction.HERE.
move
in class Vroomba
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |