|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.redfelineninja.risk.robot.Move
This class represents the choices that the robot wishes to make.
The Move can be considered as a vector (mathematical sense not
java.lang.Vector
). There are as many elements to the vector as
there are countries on the board. Each element is a float
. The
larger that value is the better it is to make a move on the associated
country. After all legal moves have been discarded then the largest
remaining element will be the move that is made.
Also included are single floats
select, fortify and done.
These are also compared to the elements, if any of these are the largest
value then their actions are performed. Please read their entries for more
information.
Move also provides some maths operations for basic manipulation of Moves
Field Summary | |
float[] |
countries
List of desire levels to click on each country |
float |
done
The desire level of the robot to finish their turn. |
static int |
DONE
This is the constant return be getMove() when the robot has
opted to finish its turn. |
float |
fortify
The desire level to move to fortify mode. |
static int |
FORTIFY
This is the constant return be getMove() when the robot has
opted to fortify its position. |
float |
select
The desire level to move to select mode. |
static int |
SELECT
This is the constant return be getMove() when the robot has
opted to return to SELECT mode. |
Constructor Summary | |
Move(int size)
Create a new move of length size. |
Method Summary | |
Move |
add(float f)
|
Move |
add(Move m)
|
int |
getMove()
Get the move that should be made. |
Move |
multiplyBy(float f)
|
Move |
multiplyBy(Move m)
Multiply this move by the supplied move. |
void |
reset()
Reset this move back to entirely zeros. |
Move |
scatter(float f)
Randomly scatter the country weights by the supplied factor. |
Move |
slideAboveZero()
Make all weights positive. |
java.lang.String |
toString()
Return this Move as a String. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int SELECT
getMove()
when the robot has
opted to return to SELECT mode.
public static final int FORTIFY
getMove()
when the robot has
opted to fortify its position.
public static final int DONE
getMove()
when the robot has
opted to finish its turn.
public float[] countries
public float select
public float fortify
public float done
Constructor Detail |
public Move(int size)
Method Detail |
public int getMove()
public void reset()
public Move multiplyBy(Move m)
public Move multiplyBy(float f)
public Move add(Move m)
public Move add(float f)
public Move scatter(float f)
f
- the weights will be scattered by +/- fpublic Move slideAboveZero()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |