public class GameRule
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Expr |
action
action expression to evaluate, after the rule was applied
|
Expr |
condition
an expression that must evaluate to true in order for this rule to be applicable
|
Expr |
currentPlayer
expression evaluating to a number of the player that can make this move
|
Expr |
element
element to move - expression that evaluates to string or a string with variable reference
|
Expr |
from
location from where the element can be moved - evaluates to string or a string with variable references
|
java.lang.String |
name
name of the rule
|
java.util.ArrayList<Expr> |
scoreAmount
a list of score values to add to each player that is in scorePlayer list in the same index
|
java.util.ArrayList<Expr> |
scorePlayer
a list of players for whom the score should be updated, if the rule was applied
|
Expr |
state
state of the element - or an expression returning a number
|
Expr |
to
location to where the element can be moved - evaluates to string or a string with variable references
|
Constructor and Description |
---|
GameRule(java.lang.String name)
construct an empty rule with the specified name
|
Modifier and Type | Method and Description |
---|---|
void |
addScores(Context context)
modify the player scores after this rule was matched
|
java.util.ArrayList<Move> |
getMatchingMoves(Element el,
GameSpecification specs,
Context context)
list of moves that can be performed from this state with the element specified in the first argument
|
boolean |
matches(Move move,
Context context)
verifies whether the specified move conforms to this rule in the provided context
|
void |
performAction(Context context)
perform the follow-up action, after this rule was matched
|
public java.lang.String name
public Expr element
public Expr state
public Expr currentPlayer
public Expr from
public Expr to
public Expr condition
public java.util.ArrayList<Expr> scorePlayer
public java.util.ArrayList<Expr> scoreAmount
public Expr action
public GameRule(java.lang.String name)
public boolean matches(Move move, Context context) throws java.lang.Exception
java.lang.Exception
public java.util.ArrayList<Move> getMatchingMoves(Element el, GameSpecification specs, Context context) throws java.lang.Exception
java.lang.Exception
public void addScores(Context context) throws java.lang.Exception
java.lang.Exception
public void performAction(Context context) throws java.lang.Exception
java.lang.Exception