Projects

Python Chess: Efficient Move Generation Using Bitwise Operations

In the previous article, we built a data structure to represent the chessboard. We used a collection of bitboards (64-bit binary numbers) and 1-hot encoding to represent the different types of pieces and their locations. We then defined a set of tools to allow us to access, modify and display this data structure.

Python Chess: Efficient Move Generation Using Bitwise Operations Read More »

Chess Programming Projects

1-Hot Encoding: The Chess Programmer’s Secret Weapon

This is not my first rodeo.

I’ve built a chess engine before, but the results were… let’s say… underwhelming.

Don’t get me wrong, the program worked; it was able to play a full game of chess, and for that, I give it credit. But let’s face it, it was terrible at chess.

It took minutes to produce a move, even at a low search depth. And then, the moves it would output were random and unpredictable: sometimes it would force you into a neat mate-in-3, other times it would sacrifice a rook and then lose the game entirely.

I recently decided it’s time for round 2, and I thought I’d document my journey and share some things I learn in the process. There are so many different problems that arise, and so many different approaches to solving them. Of all the programming rabbit holes I’ve gotten lost down, chess programming is definitely one of my favourites.

1-Hot Encoding: The Chess Programmer’s Secret Weapon Read More »

Chess Programming Projects
Scroll to Top