public class Trainer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static float |
MAX_PRIORITY
Maximum possible expansion priority
|
static float |
MIN_PRIORITY
Minimum possible expansion priority
|
Constructor and Description |
---|
Trainer(BGraph graph,
Negamax engine)
Instantiates a new openings book trainer.
|
Modifier and Type | Method and Description |
---|---|
void |
expandPaths(int numPaths,
boolean book)
Expands the given number of paths using the internal engine.
|
void |
exportToBook(java.lang.String path)
Exports all the positions found in the graph to a book file with a
format suitable for a game engine.
|
static void |
main(java.lang.String[] argv)
Main method for the class.
|
void |
outputBestLeaves(boolean book)
Outputs all the values of the leaves that can be played by the book
player in a comma-separated values format.
|
void |
refreshGraph()
Refreshes the graph scores and priorities starting from the
leaves and propagating the values up to the root.
|
int |
rootScore()
Returns the current root node's score.
|
void |
setWeight(float weight)
Sets the weight of penalty for the priority function.
|
void |
setWindow(int window)
Sets the window value for the expanded nodes.
|
public static final float MAX_PRIORITY
public static final float MIN_PRIORITY
public void setWeight(float weight)
weight
- new weight valuepublic void setWindow(int window)
window
- maximum node valuepublic int rootScore() throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException
public void expandPaths(int numPaths, boolean book) throws com.sleepycat.je.DatabaseException
numPaths
- number of paths to expandbook
- true
if the book player moves firstcom.sleepycat.je.DatabaseException
public void refreshGraph() throws com.sleepycat.je.DatabaseException
It ensures that all the values are propagated to all the parents of the nodes, thus this method is intended to be called after a large number of transpositions were found.
Note that all nodes of the graph are updated during this method call, therefore this operation is expensive to perform.
com.sleepycat.je.DatabaseException
public void exportToBook(java.lang.String path) throws com.sleepycat.je.DatabaseException, java.io.IOException
Shor.MIN_VALUE
.
The nodes are sorted according to their hash number, from the
lowest hash to the highest.path
- file path to which to write the bookcom.sleepycat.je.DatabaseException
java.io.IOException
public void outputBestLeaves(boolean book) throws com.sleepycat.je.DatabaseException
book
- true
if the book player moves firstcom.sleepycat.je.DatabaseException
public static void main(java.lang.String[] argv) throws java.lang.Exception
argv
- Command line arguments.java.lang.Exception