Class Gorgo
java.lang.Object
|
+--Player
|
+--Gorgo
- public class Gorgo
- extends Player
Gorgo is a Neandertal who wanders around in the game doing
some random things.
- Author:
- David Matuszek
|
Field Summary |
(package private) java.util.Random |
random
|
|
Constructor Summary |
Gorgo(Room startingLocation)
Constructor for objects of class Gorgo. |
|
Method Summary |
void |
doSomething()
Gorgo attempts to do something random. |
private boolean |
maybeDropSomething()
If Gorgo is holding Things, then approximately half the time
Gorgo will drop something. |
private boolean |
maybeMove()
Gorgo attempts to move in some random direction. |
private boolean |
maybeTakeSomething()
If Gorgo there are Things here, then approximately half the time
Gorgo will take something. |
java.lang.String |
toString()
Returns Gorgo's name. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
random
java.util.Random random
Gorgo
public Gorgo(Room startingLocation)
- Constructor for objects of class Gorgo.
toString
public java.lang.String toString()
- Returns Gorgo's name.
- Overrides:
toString in class java.lang.Object
doSomething
public void doSomething()
- Gorgo attempts to do something random.
maybeMove
private boolean maybeMove()
- Gorgo attempts to move in some random direction.
- Returns:
- true if Gorgo moves, false otherwise.
maybeDropSomething
private boolean maybeDropSomething()
- If Gorgo is holding Things, then approximately half the time
Gorgo will drop something.
- Returns:
- true if Gorgo drops something, false otherwise.
maybeTakeSomething
private boolean maybeTakeSomething()
- If Gorgo there are Things here, then approximately half the time
Gorgo will take something.
- Returns:
- true if Gorgo takes something, false otherwise.