My Project
|
Go to the source code of this file.
Classes | |
struct | Board |
Macros | |
#define | DLL_API |
Typedefs | |
typedef struct Board | Board |
Functions | |
void | board_init (Board *) |
Set a board to the starting position. More... | |
int | board_set (Board *, const char *) |
Set a board from a string description. More... | |
int | board_from_FEN (Board *, const char *) |
Set a board from a string description. More... | |
int | board_from_obj (Board *, const Board *, const int) |
Set a board from a Board object. More... | |
int | board_compare (const Board *, const Board *) |
Compare two board. More... | |
bool | board_equal (const Board *, const Board *) |
Compare two board for equality. More... | |
void | board_symetry (const Board *, const int, Board *) |
symetric board More... | |
int | board_unique (const Board *, Board *) |
unique board More... | |
void | board_check (const Board *) |
Check board consistency. More... | |
void | board_rand (Board *, int, struct Random *) |
Get a random board by playing random moves. More... | |
int | board_count_last_flips (const Board *, const int) |
unsigned long long | board_get_move (const Board *, const int, struct Move *) |
Compute a move. More... | |
bool | board_check_move (const Board *, struct Move *) |
Check if a move is legal. More... | |
void | board_swap_players (Board *) |
Swap players. More... | |
void | board_update (Board *, const struct Move *) |
void | board_restore (Board *, const struct Move *) |
void | board_pass (Board *) |
Passing move. More... | |
unsigned long long | board_next (const Board *, const int, Board *) |
Compute a board resulting of a move played on a previous board. More... | |
unsigned long long | board_pass_next (const Board *, const int, Board *) |
Compute a board resulting of an opponent move played on a previous board. More... | |
unsigned long long | board_get_hash_code (const Board *) |
Compute a hash code. More... | |
int | board_get_square_color (const Board *, const int) |
Get square color. More... | |
bool | board_is_occupied (const Board *, const int) |
Check if a square is occupied. More... | |
void | board_print (const Board *, const int, FILE *) |
Print out the board. More... | |
char * | board_to_string (const Board *, const int, char *) |
convert the to a compact string. More... | |
void | board_print_FEN (const Board *, const int, FILE *) |
print using FEN description. More... | |
char * | board_to_FEN (const Board *, const int, char *) |
print to FEN description. More... | |
bool | board_is_pass (const Board *) |
Check if current player should pass. More... | |
bool | board_is_game_over (const Board *) |
Check if the game is over. More... | |
int | board_count_empties (const Board *board) |
Check if the game is over. More... | |
int | count_last_flip (const int, const unsigned long long) |
DLL_API unsigned long long | get_moves (const unsigned long long, const unsigned long long) |
Get legal moves. More... | |
DLL_API bool | can_move (const unsigned long long, const unsigned long long) |
Check if a player can move. More... | |
unsigned long long | get_moves_6x6 (const unsigned long long, const unsigned long long) |
Get legal moves on a 6x6 board. More... | |
bool | can_move_6x6 (const unsigned long long, const unsigned long long) |
Check if a player can move. More... | |
int | get_mobility (const unsigned long long, const unsigned long long) |
Count legal moves. More... | |
int | get_weighted_mobility (const unsigned long long, const unsigned long long) |
int | get_potential_mobility (const unsigned long long, const unsigned long long) |
Get potential mobility. More... | |
void | edge_stability_init (void) |
Initialize the edge stability tables. More... | |
int | get_stability (const unsigned long long, const unsigned long long) |
Estimate the stability. More... | |
int | get_edge_stability (const unsigned long long, const unsigned long long) |
Estimate the stability of edges. More... | |
int | get_corner_stability (const unsigned long long) |
Estimate corner stability. More... | |
Variables | |
unsigned long long(* | flip [BOARD_SIZE+2])(const unsigned long long, const unsigned long long) |
#define DLL_API |
void board_check | ( | const Board * | board | ) |
Check board consistency.
board | the board to initialize |
Check if a move is legal.
board | board |
move | a Move. |
Compare two board.
b1 | first board |
b2 | second board |
int board_count_empties | ( | const Board * | board | ) |
Check if the game is over.
board | board. |
int board_count_last_flips | ( | const Board * | , |
const int | |||
) |
Compare two board for equality.
b1 | first board |
b2 | second board |
int board_from_FEN | ( | Board * | board, |
const char * | string | ||
) |
Set a board from a string description.
Read a Forsyth-Edwards Notation string and translate it into our internal Board structure.
board | the board to set |
string | string describing the board |
Set a board from a Board object.
board | the board to set |
obj | object describing the board. assumes player attribute as black, opponent attribute as white |
turn | turn's color |
unsigned long long board_get_hash_code | ( | const Board * | board | ) |
Compute a hash code.
board | the board. |
Compute a move.
Compute how the board will be modified by a move without playing it.
board | board |
x | square on which to move. |
move | a Move structure remembering the modification. |
int board_get_square_color | ( | const Board * | board, |
const int | x | ||
) |
Get square color.
returned value: 0 = player, 1 = opponent, 2 = empty;
board | board. |
x | square coordinate. |
void board_init | ( | Board * | board | ) |
Set a board to the starting position.
board | the board to initialize |
bool board_is_game_over | ( | const Board * | board | ) |
Check if the game is over.
board | board. |
bool board_is_occupied | ( | const Board * | board, |
const int | x | ||
) |
Check if a square is occupied.
board | board. |
x | square coordinate. |
bool board_is_pass | ( | const Board * | board | ) |
Check if current player should pass.
board | board. |
Compute a board resulting of a move played on a previous board.
board | board to play the move on. |
x | move to play. |
next | resulting board. |
void board_pass | ( | Board * | board | ) |
Passing move.
Modify a board by passing player's turn.
board | board to update. |
Compute a board resulting of an opponent move played on a previous board.
Compute the board after passing and playing a move.
board | board to play the move on. |
x | opponent move to play. |
next | resulting board. |
void board_print | ( | const Board * | board, |
const int | player, | ||
FILE * | f | ||
) |
Print out the board.
Print an ASCII representation of the board to an output stream.
board | board to print. |
player | player's color. |
f | output stream. |
void board_print_FEN | ( | const Board * | board, |
const int | player, | ||
FILE * | f | ||
) |
print using FEN description.
Write the board according to the Forsyth-Edwards Notation.
board | the board to write |
player | turn's color. |
f | output stream. |
Get a random board by playing random moves.
board | The output board. |
n_ply | The number of random move to generate. |
r | The random generator. |
int board_set | ( | Board * | board, |
const char * | string | ||
) |
Set a board from a string description.
Read a standardized string (See http://www.nada.kth.se/~gunnar/download2.html for details) and translate it into our internal Board structure.
board | the board to set |
string | string describing the board |
void board_swap_players | ( | Board * | board | ) |
Swap players.
Swap players, i.e. change player's turn.
board | board |
symetric board
board | input board |
s | symetry |
sym | symetric output board |
char * board_to_FEN | ( | const Board * | board, |
const int | player, | ||
char * | string | ||
) |
print to FEN description.
Write the board into a Forsyth-Edwards Notation string.
board | the board to write |
player | turn's color. |
string | output string. |
char * board_to_string | ( | const Board * | board, |
const int | player, | ||
char * | s | ||
) |
convert the to a compact string.
board | board to convert. |
player | player's color. |
s | output string. |
unique board
Compute a board unique from all its possible symertries.
board | input board |
unique | output board |
DLL_API bool can_move | ( | const unsigned long long | P, |
const unsigned long long | O | ||
) |
Check if a player can move.
P | bitboard with player's discs. |
O | bitboard with opponent's discs. |
bool can_move_6x6 | ( | const unsigned long long | P, |
const unsigned long long | O | ||
) |
Check if a player can move.
P | bitboard with player's discs. |
O | bitboard with opponent's discs. |
int count_last_flip | ( | const int | x, |
const unsigned long long | P | ||
) |
void edge_stability_init | ( | void | ) |
Initialize the edge stability tables.
int get_corner_stability | ( | const unsigned long long | P | ) |
Estimate corner stability.
Count the number of stable discs around the corner. Limiting the count to the corner keep the function fast but still get this information, particularly important at Othello. Corner stability will be used for move sorting.
P | bitboard with player's discs. |
int get_edge_stability | ( | const unsigned long long | P, |
const unsigned long long | O | ||
) |
Estimate the stability of edges.
Count the number (in fact a lower estimate) of stable discs on the edges.
P | bitboard with player's discs. |
O | bitboard with opponent's discs. |
int get_mobility | ( | const unsigned long long | P, |
const unsigned long long | O | ||
) |
Count legal moves.
Compute mobility, ie the number of legal moves.
P | bitboard with player's discs. |
O | bitboard with opponent's discs. |
DLL_API unsigned long long get_moves | ( | const unsigned long long | P, |
const unsigned long long | O | ||
) |
Get legal moves.
Compute a bitboard where each coordinate with a legal move is set to one.
P | bitboard with player's discs. |
O | bitboard with opponent's discs. |
unsigned long long get_moves_6x6 | ( | const unsigned long long | P, |
const unsigned long long | O | ||
) |
Get legal moves on a 6x6 board.
Compute a bitboard where each coordinate with a legal move is set to one.
P | bitboard with player's discs. |
O | bitboard with opponent's discs. |
int get_potential_mobility | ( | const unsigned long long | P, |
const unsigned long long | O | ||
) |
Get potential mobility.
Count the list of empty squares in contact of a player square.
P | bitboard with player's discs. |
O | bitboard with opponent's discs. |
int get_stability | ( | const unsigned long long | P, |
const unsigned long long | O | ||
) |
Estimate the stability.
Count the number (in fact a lower estimate) of stable discs.
P | bitboard with player's discs. |
O | bitboard with opponent's discs. |
int get_weighted_mobility | ( | const unsigned long long | P, |
const unsigned long long | O | ||
) |
|
extern |
Array of functions to compute flipped discs