PinBallDomain
Class PinBall

java.lang.Object
  extended by PinBallDomain.PinBall

public class PinBall
extends java.lang.Object

Primary PinBall domain class. This class can be mostly be dealt with directly, example code for an agent selecting actions randomly is in main.

Author:
George Konidaris (gdk at cs dot umass dot edu)

Field Summary
static int ACC_X
           
static int ACC_Y
           
static int DEC_X
           
static int DEC_Y
           
static double END_EPISODE
           
static int NONE
           
static double STEP_PENALTY
           
static double THRUST_PENALTY
           
 
Constructor Summary
PinBall()
          Constructor: create an empty PinBall domain.
PinBall(java.lang.String configfile)
          Constructor: load the domain from a configuration file.
PinBall(java.lang.String configfile, Ball b)
          Constructor: load the domain from a file, with a specified initial ball position.
 
Method Summary
 void addObstacle(Obstacle o)
          Add an obstacle to the domain.
 void deleteObstacle(int pos)
          Removes the obstacle at a given position.
 boolean episodeEnd()
          Check for end of episode.
 boolean episodeEnd(Ball b)
          Check if the episode would be over, given a ball position.
 Ball getBall()
          Get the ball object.
 Point getIntercept()
          Get the position of the last intercept.
 int getNumActions()
          Get the number of actions available in the domain
 java.util.ArrayList<Obstacle> getObstacles()
          Get a list of the obstacles.
 java.util.ArrayList<PinBallState> getStartStates()
          Get the list of start positions for the ball.
 PinBallState getState()
          Get current state.
 Target getTarget()
          Get the target object.
 void loadFromFile(java.lang.String configfile)
          Load the domain from a file.
static void main(java.lang.String[] args)
          Main.
 double step(int act)
          Given an action, advance the domain one step and return a reward.
 void writeToFile(java.lang.String configfile)
          Write the current domain configuration to a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACC_X

public static final int ACC_X
See Also:
Constant Field Values

ACC_Y

public static final int ACC_Y
See Also:
Constant Field Values

DEC_X

public static final int DEC_X
See Also:
Constant Field Values

DEC_Y

public static final int DEC_Y
See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values

STEP_PENALTY

public static final double STEP_PENALTY
See Also:
Constant Field Values

THRUST_PENALTY

public static final double THRUST_PENALTY
See Also:
Constant Field Values

END_EPISODE

public static final double END_EPISODE
See Also:
Constant Field Values
Constructor Detail

PinBall

public PinBall(java.lang.String configfile)
Constructor: load the domain from a configuration file.

Parameters:
configfile - the configuration file name.

PinBall

public PinBall(java.lang.String configfile,
               Ball b)
Constructor: load the domain from a file, with a specified initial ball position.

Parameters:
configfile - configuration file name
b - ball

PinBall

public PinBall()
Constructor: create an empty PinBall domain.

Method Detail

main

public static void main(java.lang.String[] args)
Main. Example random agent.

Parameters:
args - command-line arguments: ignored

writeToFile

public void writeToFile(java.lang.String configfile)
Write the current domain configuration to a file.

Parameters:
configfile - the configuration input file

loadFromFile

public void loadFromFile(java.lang.String configfile)
Load the domain from a file.

Parameters:
configfile - the file name

getObstacles

public java.util.ArrayList<Obstacle> getObstacles()
Get a list of the obstacles.

Returns:
an ArrayList of Obstacles.

getBall

public Ball getBall()
Get the ball object.

Returns:
the ball

getTarget

public Target getTarget()
Get the target object.

Returns:
the target

getState

public PinBallState getState()
Get current state.

Returns:
the current domain state.

step

public double step(int act)
Given an action, advance the domain one step and return a reward.

Parameters:
act - the action
Returns:
the resulting reward

episodeEnd

public boolean episodeEnd()
Check for end of episode.

Returns:
true if the episode is over, false otherwise

episodeEnd

public boolean episodeEnd(Ball b)
Check if the episode would be over, given a ball position.

Parameters:
b - the ball
Returns:
true if the episode would be over, false otherwise

getStartStates

public java.util.ArrayList<PinBallState> getStartStates()
Get the list of start positions for the ball.

Returns:
an ArrayList of start states.

addObstacle

public void addObstacle(Obstacle o)
Add an obstacle to the domain.

Parameters:
o - the new obstacle

deleteObstacle

public void deleteObstacle(int pos)
Removes the obstacle at a given position.

Parameters:
pos - position of the obstacle to remove

getIntercept

public Point getIntercept()
Get the position of the last intercept.

Returns:
the Point position of the last intercept

getNumActions

public int getNumActions()
Get the number of actions available in the domain

Returns:
5