Welcome to Bandersnatch!


Bandersnatch is an open-source chess engine written by TheApplePieGod.

To get started, click the 'open board' button and start dragging around pieces. Explore all the options and feel free to view the brief description of each. The bar underneath the board is the bot's evaluation of the current position (positive being white advantage and negative being black advantage). The evaluation takes about 3-5 seconds to update each time a move is made.

About The Project

The original intention for this project was to write a simple chess AI engine in JavaScript, but it turned into more than that. I am continually finding optimizations in the engine and improvements to the algorithm, and I hope to add rudimentary multiplayer functionality in the future along with some other cool features. The site and engine also work on mobile, which is always a cool characteristic.

About The Engine

Some of the various algorithms and concepts built into the Bandersnatch engine: Minimax searching, Alpha-Beta pruning, Quiescence searching, Move ordering, and others. The Minimax algorithm requires the use of a static evaluation function, which takes a board with any position and gives it a score via a set of rules. I plan to improve this algorithm in the future, but as of now, the evaluation function takes the following things into consideration: useful piece squares, piece point values, and some endgame algorithms involving kings.

The Bandersnatch engine actually has two counterparts: a JavaScript counterpart and a WebAssembly counterpart. Both are functionally identical, but the WebAssembly version is written in and compiled from the Rust programming language. In theory, the WebAssembly platform should be faster, but I wanted to see if that was actually the case, so I compiled some experimental data and came up with the results below.

First 10 moves from the base position at depth 6 (processor: Ryzen 5600x, memory: DDR4 2200 MHz)

12345678910Move #0.20.40.60.81.01.21.41.61.82.0Time (seconds)
Firefox (JS)
Firefox (WASM)
Chrome (JS)
Chrome (WASM)

In conclusion, porting the engine to WebAssembly was well worth it, providing significant improvements from the Firefox JavaScript engine and respectible improvements from the Chrome V8 engine. The engine being used can be changed via the settings dialog on the board page, so feel free to experiment with the differences yourself.