Hey guys ;)
I’m so glad that from this milestone forward, I can finally share not just lines of code, but actual gameplay footage and visual progress. But let’s take it one step at a time.
Rewriting the Core & Fighting IDE Autocomplete
After finishing the bitboard engine backend, I duplicated my core architecture files to keep a backup. I started by rewriting the main controller file responsible for game logic and move generation.
Right away, I hit my first roadblock: the new bitboard engine lacked game state tracking variables, so I had to refactor and add state arguments directly to the BitboardEngine class.
Once that was done, I moved on to the renderer. After adapting all the UI rendering logic to read bitmasks instead of a matrix grid, I hit "Run" with high hopes.
Guess what? Instead of a beautiful chess UI, I was greeted by a wall of terminal errors. 😅
One of the funniest bugs was caused by my IDE's autocomplete. It generated move.Move() even though the Move class was located in the exact same file. I didn't even notice it until python crashed during execution.
The Invasion of the White Pawns & Regicide
After about 30 minutes of polishing micro-bugs, the Pygame window finally opened! I clicked the "Play" button, fixed a few more runtime errors, and could finally move pieces around.
However, the game state is currently a beautiful mess:
- The Pawn Uprising: Due to a string formatting bug in the asset loader, every single piece on the board rendered as a white pawn. Funnily enough, they still moved according to their actual hidden piece types (e.g., a "pawn" sliding across the board like a rook).
- King-on-King Violence: I forgot to properly include the king in certain restriction masks. As a result, the King could happily walk into check, stand directly next to the opposing king, and even capture the enemy king straight off the board. Talk about aggressive diplomacy.
What's Next?
I also need to tweak the promotion logic because there’s currently an issue with argument parsing between the frontend and the new backend.
On Monday, I'll begin a massive bug-hunting session to stabilize special moves (en passant, castling, promotions) and ensure total state synchronization. Once the board state is bulletproof, the environment will be fully ready for Reinforcement Learning training.
I've attached a video of this chaotic gameplay below. I hope you find it entertaining!
What’s the funniest visual bug you’ve ever encountered during a major code refactor?
#python #pygame #gamedev #debugging



Top comments (0)