My Project
Functions
endgame.c File Reference
#include "search.h"
#include "bit.h"
#include "settings.h"
#include "stats.h"
#include "ybwc.h"
#include <assert.h>

Functions

static int board_solve (const Board *board, const int n_empties)
 Get the final score. More...
 
int search_solve (const Search *search)
 Get the final score. More...
 
static int board_solve_0 (const Board *board)
 Get the final score. More...
 
int search_solve_0 (const Search *search)
 Get the final score. More...
 
int board_score_1 (const Board *board, const int beta, const int x)
 Get the final score. More...
 
static int board_solve_2 (Board *board, int alpha, const int x1, const int x2, Search *search)
 Get the final score. More...
 
static int search_solve_3 (Search *search, const int alpha)
 Get the final score. More...
 
static int search_solve_4 (Search *search, const int alpha)
 Get the final score. More...
 
static int search_shallow (Search *search, const int alpha)
 Evaluate a position using a shallow NWS. More...
 
int NWS_endgame (Search *search, const int alpha)
 Evaluate an endgame position with a Null Window Search algorithm. More...
 

Detailed Description

Search near the end of the game.

Date
1998 - 2017
Author
Richard Delorme
Version
4.4

Function Documentation

◆ board_score_1()

int board_score_1 ( const Board board,
const int  beta,
const int  x 
)
inline

Get the final score.

Get the final score, when 1 empty squares remain. The following code has been adapted from Zebra by Gunnar Anderson.

Parameters
boardBoard to evaluate.
betaBeta bound.
xLast empty square to play.
Returns
The final opponent score, as a disc difference.

◆ board_solve()

static int board_solve ( const Board board,
const int  n_empties 
)
inlinestatic

Get the final score.

Get the final score, when no move can be made.

Parameters
boardBoard.
n_emptiesNumber of empty squares remaining on the board.
Returns
The final score, as a disc difference.

◆ board_solve_0()

static int board_solve_0 ( const Board board)
inlinestatic

Get the final score.

Get the final score, when the board is full.

Parameters
boardBoard.
Returns
The final score, as a disc difference.

◆ board_solve_2()

static int board_solve_2 ( Board board,
int  alpha,
const int  x1,
const int  x2,
Search search 
)
static

Get the final score.

Get the final score, when 2 empty squares remain.

Parameters
boardThe board to evaluate.
alphaAlpha bound.
x1First empty square coordinate.
x2Second empty square coordinate.
searchSearch.
Returns
The final score, as a disc difference.

◆ NWS_endgame()

int NWS_endgame ( Search search,
const int  alpha 
)

Evaluate an endgame position with a Null Window Search algorithm.

This function is used when there are still many empty squares on the board. Move ordering, hash table cutoff, enhanced transposition cutoff, etc. are used in order to diminish the size of the tree to analyse, but at the expense of a slower speed.

Parameters
searchSearch.
alphaAlpha bound.
Returns
The final score, as a disc difference.

◆ search_shallow()

static int search_shallow ( Search search,
const int  alpha 
)
static

Evaluate a position using a shallow NWS.

This function is used when there are few empty squares on the board. Here, optimizations are in favour of speed instead of efficiency. Move ordering is constricted to the hole parity and the type of squares. No hashtable are used and anticipated cut-off is limited to stability cut-off.

Parameters
searchSearch.
alphaAlpha bound.
Returns
The final score, as a disc difference.

◆ search_solve()

int search_solve ( const Search search)

Get the final score.

Get the final score, when no move can be made.

Parameters
searchSearch.
Returns
The final score, as a disc difference.

◆ search_solve_0()

int search_solve_0 ( const Search search)

Get the final score.

Get the final score, when the board is full.

Parameters
searchSearch.
Returns
The final score, as a disc difference.

◆ search_solve_3()

static int search_solve_3 ( Search search,
const int  alpha 
)
static

Get the final score.

Get the final score, when 3 empty squares remain.

Parameters
searchSearch.
alphaAlpha bound.
Returns
The final score, as a disc difference.

◆ search_solve_4()

static int search_solve_4 ( Search search,
const int  alpha 
)
static

Get the final score.

Get the final score, when 4 empty squares remain.

Parameters
searchSearch position.
alphaUpper score value.
Returns
The final score, as a disc difference.