My Project
|
Move & list of moves management. More...
#include "move.h"
#include "bit.h"
#include "board.h"
#include "hash.h"
#include "search.h"
#include "settings.h"
#include "stats.h"
#include <limits.h>
#include <assert.h>
#include <ctype.h>
#include <string.h>
Classes | |
struct | MBoard |
struct | MoveArray |
Typedefs | |
typedef struct MoveArray | MoveArray |
Functions | |
int | symetry (int x, const int sym) |
Get a symetric square coordinate. More... | |
char * | move_to_string (const int x, const int player, char *s) |
Print out a move. More... | |
void | move_print (const int x, const int player, FILE *f) |
Print out a move. More... | |
bool | move_wipeout (const Move *move, const Board *board) |
Check if a move wins 64-0. More... | |
static void | move_evaluate (Move *move, Search *search, const HashData *hash_data, const int sort_alpha, const int sort_depth) |
Evaluate a list of move. More... | |
int | movelist_get_moves (MoveList *movelist, const Board *board) |
Get moves from a position. More... | |
void | movelist_print (const MoveList *movelist, const int player, FILE *f) |
Print out a movelist. More... | |
Move * | move_next_best (Move *previous_best) |
Return the next best move from the list. More... | |
Move * | move_next_most_expensive (Move *previous_best) |
Return the next best move from the list. More... | |
Move * | move_next (Move *move) |
Return the next move from the list. More... | |
Move * | movelist_best (MoveList *movelist) |
Return the best move of the list. More... | |
Move * | movelist_first (MoveList *movelist) |
Return the first move of the list. More... | |
void | movelist_evaluate (MoveList *movelist, Search *search, const HashData *hash_data, const int alpha, const int depth) |
Evaluate a list of move in order to sort it. More... | |
Move * | movelist_sort_bestmove (MoveList *movelist, const int move) |
Sort a move as best. More... | |
void | movelist_sort_cost (MoveList *movelist, const HashData *hash_data) |
Sort all moves except the first, based on move cost & hash_table storage. More... | |
void | movelist_sort (MoveList *movelist) |
Sort all moves. More... | |
Move * | movelist_exclude (MoveList *movelist, const int move) |
Exclude a move. More... | |
bool | movelist_is_empty (const MoveList *movelist) |
Check if the list is empty. More... | |
void | line_init (Line *line, const int player) |
Initialize a sequence of moves. More... | |
void | line_push (Line *line, const int x) |
Add a move to the sequence. More... | |
void | line_pop (Line *line) |
Remove the last move from a sequence. More... | |
void | line_copy (Line *dest, const Line *src, const int from) |
Copy part of a sequence to another sequence. More... | |
void | line_print (const Line *line, int width, const char *separator, FILE *f) |
Print a move sequence. More... | |
char * | line_to_string (const Line *line, int n, const char *separator, char *string) |
Line to string. More... | |
static void | movearray_init (MoveArray *array) |
array initialisation. More... | |
static void | movearray_delete (MoveArray *array) |
array supression. More... | |
static bool | movearray_append (MoveArray *array, const Board *b, const int x) |
Append a position. More... | |
void | movehash_init (MoveHash *hash, int bitsize) |
Initialisation of the hash table. More... | |
void | movehash_delete (MoveHash *hash) |
Free the hash table. More... | |
bool | movehash_append (MoveHash *hash, const Board *b, const int x) |
Append a position to the hash table. More... | |
Variables | |
const Move | MOVE_INIT = {0, NOMOVE, -SCORE_INF, 0, NULL} |
const Move | MOVE_PASS = {0, PASS, -SCORE_INF, 0, NULL} |
const int | SQUARE_VALUE [] |
Move & list of moves management.
Move & list of moves management - header file.
Copy part of a sequence to another sequence.
dest | the destination move sequence. |
src | the source move sequence. |
from | the point to copy from. |
void line_init | ( | Line * | line, |
const int | player | ||
) |
Initialize a sequence of moves.
line | the move sequence. |
player | color of the first player of the sequence. |
void line_pop | ( | Line * | line | ) |
Remove the last move from a sequence.
line | the move sequence. |
void line_print | ( | const Line * | line, |
int | width, | ||
const char * | separator, | ||
FILE * | f | ||
) |
Print a move sequence.
line | the move sequence. |
width | width of the line to print (in characters). |
separator | a string to print between moves. |
f | output stream. |
void line_push | ( | Line * | line, |
const int | x | ||
) |
Add a move to the sequence.
line | the move sequence. |
x | move coordinate. |
char * line_to_string | ( | const Line * | line, |
int | n, | ||
const char * | separator, | ||
char * | string | ||
) |
Line to string.
line | the move sequence. |
n | number of moves to add. |
separator | a string to print between moves. |
string | output string receiving the line. |
|
static |
Evaluate a list of move.
Evaluate the moves to sort them. Evaluation is based on, in order of importance:
Return the next move from the list.
move | previous move. |
Return the next best move from the list.
previous_best | Last best move. |
Return the next best move from the list.
previous_best | Last best move. |
void move_print | ( | const int | x, |
const int | player, | ||
FILE * | f | ||
) |
Print out a move.
Print the move, using letter case to distinguish player's color, to an output stream.
x | square coordinate to print. |
player | player color. |
f | output stream. |
char * move_to_string | ( | const int | x, |
const int | player, | ||
char * | s | ||
) |
Print out a move.
Print the move, using letter case to distinguish player's color, to an output stream.
x | Square coordinate to print. |
player | Player color. |
s | Output string. |
|
static |
array supression.
array | Array of positions. |
|
static |
array initialisation.
array | Array of positions. |
void movehash_init | ( | MoveHash * | hash, |
int | bitsize | ||
) |
Return the best move of the list.
movelist | The list of move. |
Exclude a move.
movelist | List of moves to sort. |
move | Move to exclude. |
Return the first move of the list.
movelist | The list of move. |
Get moves from a position.
movelist | movelist. |
board | board. |
bool movelist_is_empty | ( | const MoveList * | movelist | ) |
Check if the list is empty.
movelist | The list of move. |
void movelist_print | ( | const MoveList * | movelist, |
const int | player, | ||
FILE * | f | ||
) |
Print out a movelist.
Print the moves, using letter case to distinguish player's color, to an output stream.
movelist | a list of moves. |
player | player color. |
f | output stream. |
void movelist_sort | ( | MoveList * | movelist | ) |
Sort all moves.
movelist | List of moves to sort. |
Sort a move as best.
Put the best move at the head of the list.
movelist | List of moves to sort. |
move | Best move to to set first. |
Sort all moves except the first, based on move cost & hash_table storage.
movelist | List of moves to sort. |
hash_data | Data from the hash table. |
int symetry | ( | int | x, |
const int | sym | ||
) |
Get a symetric square coordinate.
x | Square coordinate. |
sym | Symetry. |
const int SQUARE_VALUE[] |