# RobotPlayer (vilya 1.3 API)
Date: 2011-04-06

## com.threerings.parlor.util
Class RobotPlayer

    java.lang.Object
      com.samskivert.util.Interval
          com.threerings.parlor.util.RobotPlayer

    public class RobotPlayer

extends Interval

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.RunBuddy`

Constructor Summary
`RobotPlayer(Component target, com.threerings.util.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, create, resetTimer, schedule, schedule, schedule, schedule, schedule, setRunQueue`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RobotPlayer

    public RobotPlayer(Component target,
                       com.threerings.util.KeyTranslator xlate)

  Constructs a robot player.

Method Detail

### setActive

    public void setActive(boolean active)

  Sets whether the robot player is actively posting action commands.

### setRobotDelay

    public void setRobotDelay(long delay)

  Sets the delay in milliseconds between posting each action command.

### isActive

    public boolean isActive()

  Returns whether the robot is currently active and periodically posting action commands.

### expired

    public void expired()

  Specified by:
    `expired` in class `Interval`

Copyright © 2011. All Rights Reserved.