Development

Here you can access all the sources for the Bagheera Dou Shou Qi playing engine as well as the web interface. Note that the source of the engine is unavailable until the end of LIACS AI2015.

The Chess Programming Wiki has been proven to be very useful in the development.

Known Issues

Very limited browser support. Why does everyone want to use a different standard?

The LIACS webserver is very limited in capacity. Therefore we use only a small transposition table.

The web interface is unable to check for repetition draws (normally, threefold repetition is declared a draw). Mainly because the engine cannot run continuously (this is a PHP issue).

The engine communicates via STDIN and STDOUT. The original plan was to start a PHP session which launches an instance of the engine with pipes bound to its STDIN and STDOUT. This way only moves have to be comminucated as with the terminal version. We used proc_open to launch a process with bound pipes. However, at the end of a PHP page the function proc_close is called (stackoverflow), which is not our intention.

Web Interface

This website is developed using XHTML, CSS, JavaScript, Ajax, PHP, and C++. And is compliant with Mozilla Firefox, W3C Markup Validation Service, W3C CSS Validation Service, JSLint, and GCC.

Core (game logic)

The game logic is written in C++, and is highly? optimized. Primarily by using branchless code (or perfectly predictable branching) It makes some assumptions on the platform: little-endian, x86/x86-64. Note that this version is different from the LIACS AI2013 version.

Interface

Provides a basic ASCII interface.

Bagheera

The Bagheera engine is written in C++ based on the Core (game logic) framework. Further platform restrictions apply here: POSIX.

Implemented and tried features include: Search algorithms: negamax, alphabeta pruning (fail-soft), quiescence search, negascout (seems to perform best), iterative deepening, aspiration windows, and MTD(f) in combination with transposition tables. Move ordering: static ordered move generation, static move sorting, dynamic move sorting: history heuristics (seems to perform badly at deep searches, so not used), butterfly heuristic (not used), and principal variation heuristic. We tried null-move pruning, but we got bad results, so not used. No other pruning heuristics are used yet (the result will always be the exact minimax value of the tree).
The implementation here provided is not the same as the one currently running on the LIACS webserver. There seem to be problems with the transposition history in an alpha-beta search with only a few pieces on the board: a drawn position will eventually yield a win (or loss) in the search.

Retrograde Engine

The Retrograde engine creates an endgame tablebase upto N pieces, with N specified by the user. N can be set by changing the constant USED_PIECES in the file constants.h. No other constants should be changed.

The retrograde engine is dependent on the core, which is also provided. It can be compiled with g++, using a command similar to:
g++ -Wall -Wextra -o retrograde main.cc output_writer.cc ../core/position.cc
(Note that the core file positions.cc is in turn dependent on other core files.)

The retrograde engine writes its output to the stdout; for every position a single space separated line is written in the following format:
w Re8 5 0e7xxxxxxxxxxxxxxxxxxxxxxxxg1xxxx

The first column contains the winner of that position, the second column the best move. The best move is considered to be a move that can force a win in the least number of plies, if possible. If the position is lost, it contains a move with the best counter ply. The third column contains the number of plies until the game converges to such a state. In the case of a draw, this is unknown. The last column contains a string describing the position.