public class BlockDudeModel extends java.lang.Object implements FullStateModel
FullStateModel.Helper
Constructor and Description |
---|
BlockDudeModel(int maxx,
int maxy) |
Modifier and Type | Method and Description |
---|---|
protected BlockDudeCell |
getBlockAt(BlockDudeState s,
int x,
int y)
Finds a block object in the
State located at the provided position and returns it |
int |
greatestHeightBelow(BlockDudeState s,
int[][] map,
int xWidth,
int x,
int maxY)
Returns the maximum height of the world at the provided x coordinate that is <= the value maxY.
|
protected void |
moveCarriedBlockToNewAgentPosition(BlockDudeState s,
BlockDudeAgent agent,
int ax,
int ay,
int nx,
int ny)
Moves a carried block to a new position of the agent
|
void |
moveHorizontally(BlockDudeState s,
int dx)
Modifies state s to be the result of a horizontal movement.
|
void |
moveUp(BlockDudeState s)
Modifies state s to be the result of a vertical movement, that will result in the agent onto the platform adjacent
to its current location in the direction the agent is facing, provided that there is room for the agent (and any block
it's holding) to step onto it.
|
void |
pickupBlock(BlockDudeState s)
Modifies state s to be the result of the pick up action.
|
void |
putdownBlock(BlockDudeState s)
Modifies state s to put down the block the agent is holding.
|
State |
sample(State s,
Action a)
Samples and returns a
State from a state transition function. |
java.util.List<StateTransitionProb> |
stateTransitions(State s,
Action a)
|
public java.util.List<StateTransitionProb> stateTransitions(State s, Action a)
FullStateModel
Action
is applied in State
s. The returned
list only needs to include transitions that have non-zero probability of occurring.stateTransitions
in interface FullStateModel
s
- the source statea
- the action to be applied in the source stateStateTransitionProb
objects.public State sample(State s, Action a)
SampleStateModel
State
from a state transition function.sample
in interface SampleStateModel
s
- the source statea
- the action to be executed in the source stateState
public void moveHorizontally(BlockDudeState s, int dx)
s
- the state to modifydx
- the change in x direction; should only be +1 (east) or -1 (west).public void moveUp(BlockDudeState s)
s
- the state to modify.public void pickupBlock(BlockDudeState s)
s
- the state to modify.public void putdownBlock(BlockDudeState s)
s
- the state to modifyprotected void moveCarriedBlockToNewAgentPosition(BlockDudeState s, BlockDudeAgent agent, int ax, int ay, int nx, int ny)
s
- the state to modifyagent
- the agentax
- the previous x position of the agentay
- the previous y position of the agentnx
- the new x position of the *agent*ny
- the new y position of the *agent*protected BlockDudeCell getBlockAt(BlockDudeState s, int x, int y)
State
located at the provided position and returns its
- the state to checkx
- the x positiony
- the y positionBlockDudeCell
for the corresponding block object in the state at the given position or null if one does not exist.public int greatestHeightBelow(BlockDudeState s, int[][] map, int xWidth, int x, int maxY)
s
- the state to searchmap
- the brick mapxWidth
- the maximum x dimensionality of the worldx
- the x position to searchmaxY
- the y position under which the highest point is searched