
Advantages can come in the form of capturing opponent pieces, or having pieces in favourable positions. Any advantages gained by Player A implies disadvantages for Player B. each set of positions of pieces on the board) so that our AI can make decisions on which positions are more favourable than other positions.Ĭhess is a zero-sum game.

Basically, we want to assign a ‘score’ to each chessboard instance (i.e. But how do we implement an AI that plays (reasonably) good chess? Well, we’re going to need an evaluation function. With these libraries, you should be able to create a working chess game by following the examples (5000 through 5005 in particular) on the chessboard.js website. the chess board itself.Ĭhess.js handles the game mechanics, such as move generation / validation. This allows us to direct our focus towards only the most fascinating aspect of the application: the decision-making (AI) part! For this, we will be using external libraries:Ĭhessboard.js handles the graphical interface, i.e. Getting the GUI and game mechanics out of the way. These will be explained in-depth later on, and should be relatively simple to grasp if you have experience in programming. The two main algorithms involved are the minimax algorithm and alpha-beta pruning. Everything else will be covered as part of this tutorial.

You should know basic programming and the general concept of a tree data structure. Uses the chess.js and chessboard.js libraries.
