public class MoveAction extends SimplePropertyObject implements ISpaceAction
| Modifier and Type | Class and Description |
|---|---|
static interface |
MoveAction.IMoveEvaluator
Interface for evaluating moves.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
DIRECTION_DOWN
The move direction down.
|
static String |
DIRECTION_LEFT
The move direction left.
|
static String |
DIRECTION_NONE
Placeholder for "no move" action.
|
static String |
DIRECTION_RIGHT
The move direction right.
|
static String |
DIRECTION_UP
The move direction up.
|
static String |
PARAMETER_DIRECTION
The move direction parameter.
|
static String |
PROPERTY_LASTPOS
The last position property (only for hunters).
|
ACTOR_ID, OBJECT_ID| Constructor and Description |
|---|
MoveAction() |
| Modifier and Type | Method and Description |
|---|---|
static String |
evaluateMoves(Grid2D space,
IVector2 sourcepos,
MoveAction.IMoveEvaluator eval)
Get the best move.
|
static String |
getAvoidanceDirection(Grid2D space,
IVector2 sourcepos,
ISpaceObject[] objects)
Move to stay away from the given objects.
|
static String |
getDirection(Grid2D space,
IVector2 sourcepos,
IVector2 targetpos)
Get the best way to go towards a direction.
|
static String[] |
getPossibleDirections(Grid2D space,
IVector2 sourcepos)
Get the possible moves.
|
Object |
perform(Map parameters,
IEnvironmentSpace space)
Performs the action.
|
addPropertyChangeListener, getProperties, getProperty, getPropertyNames, hasProperty, removePropertyChangeListener, setProperties, setProperty, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitgetProperty, getPropertyNames, hasProperty, setPropertypublic static final String PARAMETER_DIRECTION
public static final String PROPERTY_LASTPOS
public static final String DIRECTION_LEFT
public static final String DIRECTION_RIGHT
public static final String DIRECTION_UP
public static final String DIRECTION_DOWN
public static final String DIRECTION_NONE
public Object perform(Map parameters, IEnvironmentSpace space)
perform in interface ISpaceActionparameters - parameters for the actionspace - the environment spacepublic static String getDirection(Grid2D space, IVector2 sourcepos, IVector2 targetpos)
space - The 2D space to move in.sourcepos - The source position.targetpos - The target position.public static String getAvoidanceDirection(Grid2D space, IVector2 sourcepos, ISpaceObject[] objects)
space - The 2D space to move in.sourcepos - The source position.objects - The objects to avoid.public static String evaluateMoves(Grid2D space, IVector2 sourcepos, MoveAction.IMoveEvaluator eval)
space - The 2D space to move in.sourcepos - The source position.eval - The move evaluator.public static String[] getPossibleDirections(Grid2D space, IVector2 sourcepos)
space - The 2D space to move in.sourcepos - The source position.Copyright © 2013. All Rights Reserved.