|
My Project
|
#include "eval.h"#include "bit.h"#include "board.h"#include "options.h"#include "move.h"#include "util.h"#include <stdlib.h>#include <assert.h>Go to the source code of this file.
Classes | |
| struct | CoordinateToFeature |
| struct | FeatureToCoordinate |
Typedefs | |
| typedef struct CoordinateToFeature | CoordinateToFeature |
| typedef struct FeatureToCoordinate | FeatureToCoordinate |
Functions | |
| static int | opponent_feature (int l, int d) |
| Opponent feature. | |
| void | eval_open (const char *file) |
| Load the evaluation function features' weights. | |
| void | eval_close (void) |
| Free global resources allocated to the evaluation function. | |
| void | eval_init (Eval *eval) |
| Initialize a new evaluation function. | |
| void | eval_free (Eval *eval) |
| Free resources used by the evaluation function. | |
| void | eval_set (Eval *eval, const Board *board) |
| Set up evaluation features from a board. | |
| static void | eval_swap (Eval *eval) |
| Swap player's feature. | |
| static void | eval_update_0 (Eval *eval, const Move *move) |
| Update the features after a player's move. | |
| static void | eval_update_1 (Eval *eval, const Move *move) |
| Update the features after a player's move. | |
| void | eval_update (Eval *eval, const Move *move) |
| static void | eval_restore_0 (Eval *eval, const Move *move) |
| Restore the features as before a player's move. | |
| static void | eval_restore_1 (Eval *eval, const Move *move) |
| void | eval_restore (Eval *eval, const Move *move) |
| void | eval_pass (Eval *eval) |
| Update/Restore the features after a passing move. | |
| double | eval_sigma (const int n_empty, const int depth, const int probcut_depth) |
| Compute the error-type of the evaluation function according to the depths. | |
Variables | |
| static const FeatureToCoordinate | EVAL_F2X [] |
| static const CoordinateToFeature | EVAL_X2F [] |
| static const int | EVAL_SIZE [] = {19683, 59049, 59049, 59049, 6561, 6561, 6561, 6561, 2187,729, 243, 81, 1} |
| static const int | EVAL_PACKED_SIZE [] = {10206, 29889, 29646, 29646, 3321, 3321, 3321, 3321, 1134, 378, 135, 45, 1} |
| static const int | EVAL_OFFSET [] |
| static const int | EVAL_MAX_VALUE [] |
| static int | EVAL_C10 [2][59049] |
| static int | EVAL_S10 [2][59049] |
| static int | EVAL_C9 [2][19683] |
| static int | EVAL_S8 [2][6561] |
| static int | EVAL_S7 [2][2187] |
| static int | EVAL_S6 [2][729] |
| static int | EVAL_S5 [2][243] |
| static int | EVAL_S4 [2][81] |
| static const int | EVAL_N_WEIGHT = 226315 |
| static const int | EVAL_N_PLY = 61 |
| static const int | EVAL_N_FEATURE = 47 |
| static int | EVAL_LOADED = 0 |
| short *** | EVAL_WEIGHT |
| static double | EVAL_A |
| static double | EVAL_B |
| static double | EVAL_C |
| static double | EVAL_a |
| static double | EVAL_b |
| static double | EVAL_c |
Evaluation function.
| typedef struct CoordinateToFeature CoordinateToFeature |
coordinate to feature conversion
| typedef struct FeatureToCoordinate FeatureToCoordinate |
feature to coordinates conversion
| void eval_close | ( | void | ) |
Free global resources allocated to the evaluation function.
| void eval_free | ( | Eval * | eval | ) |
Free resources used by the evaluation function.
| eval | Evaluation function. |
| void eval_init | ( | Eval * | eval | ) |
Initialize a new evaluation function.
Allocate space to store the state of the evaluation function.
| eval | Evaluation function. |
| void eval_open | ( | const char * | file | ) |
Load the evaluation function features' weights.
The weights are stored in a global variable, because, once loaded from the file, they stay constant during the lifetime of the program. As loading the weights is time & resource consuming, a counter variable check that the weights are effectively loaded only once.
| file | File name of the evaluation function data. |
| void eval_pass | ( | Eval * | eval | ) |
Update/Restore the features after a passing move.
| eval | Evaluation function. |
Restore the features as before a player's move.
| eval | Evaluation function. |
| move | Move. |
Set up evaluation features from a board.
| eval | Evaluation function. |
| board | Board to setup features from. |
| double eval_sigma | ( | const int | n_empty, |
| const int | depth, | ||
| const int | probcut_depth ) |
Compute the error-type of the evaluation function according to the depths.
A statistical study showed that the accuracy of the alphabeta mostly depends on the depth & the ply of the game. This function is useful to the probcut algorithm. Using a function instead of a table of data makes easier to inter- or extrapolate new values.
| n_empty | Number of empty squares on the board. |
| depth | Depth used in alphabeta. |
| probcut_depth | A shallow depth used in probcut algorithm. |
|
static |
Swap player's feature.
| eval | Evaluation function. |
Update the features after a player's move.
| eval | Evaluation function. |
| move | Move. |
Update the features after a player's move.
| eval | Evaluation function. |
| move | Move. |
|
static |
Opponent feature.
Compute a feature from the opponent point of view.
| l | feature. |
| d | feature size. |
|
static |
evaluation function error coefficient parameters
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
feature symetry packing
|
static |
|
static |
array to convert features into coordinates
|
static |
eval weight load status
|
static |
|
static |
number of features
|
static |
number of plies
|
static |
number of (unpacked) weights
|
static |
feature offset
|
static |
packed feature size
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
feature size
| short*** EVAL_WEIGHT |
eval weights
|
static |
array to convert coordinates into feature