Hello everyone, my goal here is to learn C++ by attempting to make a chess engine.
While I have learned the basics of Python and Java, I’m completely new to C++. I’ve been tackling the tome C++ Crash Course from No Starch Press this month and will be using what I learn to create the engine.
As I’m not sure how much time it’ll take me to complete the project I decided to break it up into smaller steps. Completing any of them by February would be a win for me.
Store and update piece positions based on user input.
- This includes removing pieces if another piece lands on that spot
Move pieces according to the rules
- Things like diagonals for bishops, the L shape for knights
Implement restrictions on movements
- Pawns can only capture diagonally, you can’t move a piece if it puts the king in check, etc.
Implement some kind of gui so you can see the board
Create a computer opponent you can play against
-I’d like to do something with Nueral Networks via Pytorch/TensorFlow, but thats down the road.
That’s probably the most brutal part of the project. If you’re just starting I’d probably mark that as a stretch goal.
Also I’m not sure if neural networks are needed for that, they way I’d do it is by using move sets and weighing the next move using statistical analysis(perhaps by obtaining a large enough dataset from publicly available chess servers?).
Just my 2 ¢
As it turns out I ended up pushing this project aside for awhile to focus on building a home server for the first time. I got rather lucky and got a good deal on some computer parts during the holiday. For less than $200 I picked up a Ryzen 3800XT, MSI B550M, Kracken X53, 16 GB DDR4 and a 500GB NVME.
I put everything together on my desk with a spare GPU and power supply I had my desk and was happy it posted just fine (after shorting out the power pins with a screwdriver). After replacing the thermal paste on the CPU I went through a couple dry runs installing/reinstalling Prox Mox onto the system.
The choice of Prox Mox was arbitrary, I just picked a random platform that seemed popular. I ordered a Fractal 804 and four 4 terabyte HD’s (iron wolf and WD Red’s) and installed everything. I set up TrueNAS Scale within a VM in ProxMox, but I haven’t seen much utility in that. TrueNAS Scale seems to do everything well enough, so I don’t see much obvious use in having it nested within ProxMox. I haven’t had much time to touch it or research further so it’ll stay that way for now. As it stands it’s running PiHole and a NAS for my windows/Linux systems.
With regards to my C++ chess engine it’s going fairly well. Syntatically its close to Java and was easy enough to pick up. After spending some time reading through some of the C++ books I have I’ve written enough to knock off the first step on my list.