ai
Class Variation
java.lang.Object
ai.Variation
public class Variation
- extends Object
A Variation represents the sequence of optimal plays from a game
state.
It is an immutable linked list, where each cell contains a move,
the value associated with that cell, and the length of the list.
- Specification Fields
-
-
value
: int // The value that the current player gets
// by playing optimally.
-
depth
: int //The number of plays this Variation is known to.
-
move
: Move //The current move to make
-
variation
: Variation //The next player's Variation after the move
Abstract invariant
depth = length(variation)
value is consistent.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Variation
public Variation(int value)
getValue
public int getValue()
- Returns:
- The value for this player with this variation.
getMove
public Move getMove()
- Returns:
- The move at this point of the variation.
getDepth
public int getDepth()
- Returns:
- The depth from this point of the variation.
cons
public Variation cons(Move move)
- Returns:
- A new variation with a given Move as the first move
and this as the rest.
cdr
public Variation cdr()
- Returns:
- The rest of the Variation.