|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.samskivert.util.Interval
com.threerings.parlor.util.RobotPlayer
public class RobotPlayer
The robot player is a computer player with truly rudimentary artificial
intelligence that periodically posts random commands selected from the
available key press and release commands to the target component.
Note that Robot could have been used to post key
events to the target component rather than commands, but not all key
events can be simulated in that fashion (e.g., a right shift key
press), and this seemed somehow more proper in any case.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.samskivert.util.Interval |
|---|
Interval.Factory, Interval.IntervalTask, Interval.RunBuddy |
| Field Summary | |
|---|---|
protected boolean |
_active
Whether the robot is active or not. |
protected List<String> |
_press
The list of available key press action commands. |
protected List<String> |
_release
The list of available key release action commands. |
protected long |
_robotDelay
The milliseconds between posting each action command. |
protected Component |
_target
The target component associated with game action commands. |
protected KeyTranslator |
_xlate
The key translator that describes available keys and commands. |
protected static long |
DEFAULT_ROBOT_DELAY
The default robot delay. |
| Fields inherited from class com.samskivert.util.Interval |
|---|
_runQueue, _task, _timer, RUN_DIRECT |
| Constructor Summary | |
|---|---|
RobotPlayer(Component target,
KeyTranslator xlate)
Constructs a robot player. |
|
| Method Summary | |
|---|---|
void |
expired()
|
boolean |
isActive()
Returns whether the robot is currently active and periodically posting action commands. |
void |
setActive(boolean active)
Sets whether the robot player is actively posting action commands. |
void |
setRobotDelay(long delay)
Sets the delay in milliseconds between posting each action command. |
| Methods inherited from class com.samskivert.util.Interval |
|---|
cancel, create, createTimer, noteRejected, safelyExpire, schedule, schedule, schedule, schedule, schedule, scheduleTask, setRunQueue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final long DEFAULT_ROBOT_DELAY
protected boolean _active
protected long _robotDelay
protected List<String> _press
protected List<String> _release
protected KeyTranslator _xlate
protected Component _target
| Constructor Detail |
|---|
public RobotPlayer(Component target,
KeyTranslator xlate)
| Method Detail |
|---|
public void setActive(boolean active)
public void setRobotDelay(long delay)
public boolean isActive()
public void expired()
expired in class Interval
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||