Modifier and Type | Field and Description |
---|---|
static int |
ENTRY_SIZE
Size in bytes of a database entry
|
static java.lang.String |
SIGNATURE
Header signature for the book format
|
Constructor and Description |
---|
OwareRoots(java.io.File file)
Initializes a new
Book object wich will read entries from
a file stored on disk. |
Modifier and Type | Method and Description |
---|---|
int[] |
findBestMoves(Game game)
Returns a list of best moves found on the book for the provided
position on the
Game object. |
void |
newMatch()
Notifies the book intance that the next positions are going to
be from a different match.
|
int |
pickBestMove(Game game)
Chooses one move at random from the best moves found on the book
for a given game state.
|
void |
setScoreMargin(int margin)
Sets the score margin for the book.
|
fields, finalize, getDatabase, getField, getVersion
public static final java.lang.String SIGNATURE
public static final int ENTRY_SIZE
public OwareRoots(java.io.File file) throws java.io.IOException
Book
object wich will read entries from
a file stored on disk.file
- the database file for the bookFileNotFoundException
- If the file could not be openedjava.io.IOException
- If an I/O exception occurredpublic void setScoreMargin(int margin)
margin
- an integer value greater or equal to zeropublic void newMatch()
public int pickBestMove(Game game) throws java.io.IOException
pickBestMove
in interface Roots
game
- The game to search a move forGame.NULL_MOVE
if the
position does not exist on the database or the
book got out of moves for the current gamejava.io.IOException
- If an I/O exception occurredpublic int[] findBestMoves(Game game) throws java.io.IOException
Game
object.game
- The game to search a move forjava.io.IOException
- If an I/O exception occurred