2 Player Chess

From UBC Wiki

Authors: Aaditya Desai, Kulladit Udol

What is the problem?

Creating a 2 player Chess game, which will update the game after each player makes their move. I would like the game to be able to recognize what are the possible legal moves and it should also be able to recognize when a move is illegal.

What is the something extra?

I would like to add features like pawn promotion, castling, and at the same time i would like to display the move history which will also be updated after each move.

What did we learn from doing this?

The big lesson we learned from this was that coming up with a good representation for chess's game state is hard, and finding the right function types even more so. During development the code had to be majorly rewritten three times to account for some previously overlooked nuances of some specific mechanic which, unfortunately, were rather hard to foresee when first starting out. The mechanics in question were mainly castling and en passant, which I will now detail.

Kings and pawns are a pain. In addition to having a different set of movement and capture moves (which also changes direction depending on their color), pawns can also advance two ranks in a turn (but only when they're on their starting square), occasionally perform the glorious en passant, and turn into other pieces with promotion. As for the kings, they can castle but only in very specific circumstances. Both of these pieces have mechanics that require more than just the board state, hence the need for separate flags for both castling and en passant, and a corresponding move type for both.

Work division

How was the workload divided? Who did what? (This can be in a private communication to the TA if you do not want it to be public).

Links to code etc.

https://github.com/HakkeiZOMbie/TwoPlayerChess.git