This blog series will serve as my defacto documentation for my chess programming journey. I plan on hosting this on my main dev.to, as well as on Lichess when I get around to it. Though I'm still an infant programmer in the grand scheme of things, I have rather quickly come up with a sort of learning regiment when diving into a new language. Being a college student and having gone through only the basic courses so far, I've found my Data Structures and Algorithms course I took in Spring 2024 very useful in not only building a fairly solid foundation for my programming skills, but also extremely useful when wanting to learn a new language.
Java is what we were taught with (huge surprise I know), and we learned a few sorting algorithms -- though we never really got around to actually implementing any of these algorithms -- and also the big "four" core data structures as I like to refer to them:
- Link List
- Queue
- Stack
- Binary Tree
Thankfully, we actually did get to work on some projects that implemented these data structures. The most notable for me was getting to implement a card game utilizing a stack. I won't bore you with all the details from my basic implementation, but I will say it was a great way to dip my toes into game development. I had the opportunity to implement a basic "game loop" where it just asked to keep drawing cards. I was however able to use what I learned during this project, and apply these lessons to my personal project of making a game of Black Jack written in Go.
I was able to generate multiple decks into a single deck stack, and then shuffle them in a standard pseudo random order seeded by the system time and date. I managed to create a hand -- which I believe I ended up using either a queue or simple slice -- for both one player and the dealer. Then drawing from the deck, I was able to insert the card into the player's hand and then to the dealer's hand. A fairly simple game loop was made and score for both the player and dealer was kept, where a check was implemented so the dealer wouldn't draw after a soft 17 was achieved (don't worry if you aren't too familiar with Black Jack terminology, I won't dwell on this for much longer). There were quite a few more things to implement to make it a fully working game of Black Jack, but I was happy and content with what I had achieved, I may revisit it after achieving the core functionality of my current project. Speaking of which...
Beginning of my chess journey: Like pretty much the majority of everyone else, during the pandemic I took up learning chess as a personal hobby and past time. I'm not as good as I would like to be, and I scoured many online resources and programs that were recommended for improvement. I started off which chess.com and it's analysis tools before I quickly outgrew the basics it provided. I found Lichess, and became much more fond of their UI and feel (I swear it's not because I'm 300 points higher rated there), and their studies are amazing! Although, something was still missing, for as great as the studies tool is, and I do love to use it still, it wasn't resonating much with me for maintaining a much more extensive repertoire.
Don't worry chess gurus out there, I don't study the openings to death, I focus on my tactics first and foremost. However, I do like being able to have lines mapped out of which ones I encounter the most, so when I go back and review games later, I can see where exactly things went offtrack or what I missed in a position. It's a great feeling when I don't exactly remember what move my repertoire had, but my intuition in a position helps me find those moves naturally. For this gap I found Chess Tempo, another great resource for the aspiring club player.
Being able to manage multiple repertoires for both colours, and collapse what I don't need is a godsend. Unfortunately, like previously with chesscom's and Lichess's tooling, I hit some limitations; specifically, I hit the number of repertoires I'm allowed to keep on Chess Tempo for free. Also, sometimes exporting and importing pgn files were a bit buggy, sometimes I would get empty files, other times my comments wouldn't populate my repertoire on Chess Tempo. Despite these limitations, I still use both Lichess studies and analysis tools -- I even purchased a lifetime supporter badge to show my appreciation -- as well as chess tempo to manage my repertoire's and I use both for tactics training. I only really use chess.com anymore for puzzles and every now and then I'll play some blitz games there as well. I ended up looking into several tools that can be downloaded for offline study.
Trying to be the very best: Or at the very least, better than I was yesterday. I had quickly found the Golden Standard program that the top players of chess all use, ChessBase. However, I have yet to take a chance and investing into this software for whatever gains I think it may provide me. I asked myself what am i really looking for with this type of software. Mainly, I want a program that can allow me to view a game from a pgn file I give it, I want to create pgn files with the program, I would like to keep a database of all games I've played, both online and offline, and I would like to be able to analyze a position with an engine if capable. I pretty much was able to find all that with two applications, ChessX and SCID vs PV.
I won't dive to deep into these programs, because a review is not meant to be my purpose for this blog series (and I kinda want to move on to the last section of this blog). Suffice to say, they are amazing programs for what they provide and are great tools for an aspiring club player, but they do leave some wants, and do suffer a bit from some un-intuitiveness -- Though the maintainers for each do their very best to minimize this factor (though I can't really tell since I don't have access to the golden standard).
One of the benefits, and often times curses, of being a software developer/tinkerer/dabbler is that we have the capability to implement -- or try to implement -- our own vision of what we believe a software application should provide to it's user base. So I decided, in my immense wisdom of two semesters of basic cs core classes and that one time I made a game of rock-paper-scissors in java that froze when the random picker function chose paper sometimes, to create my own chess gui. Thankfully, there are plenty of resources and open source projects to reference. Unfortunately, there is a bit of a universal standard today, in which all chess projects follow that makes going against the tide a bit cumbersome and difficult (A bit more on that in the next blog post).
The Basic Outline: So the main resource I've been using for my chess project is of course the Chess Programming Wiki. It has many topics, references many other resources and forums, and provides a decent starting out plan and outline for a chess project. Unfortunately (my favorite word), it's main focus has to do with making a chess engine, and some of the more basic topic details are kinda brushed over in favor of engine specific topics. If you are only interested in making a working game of chess, and not making an engine that can play chess, then the only two topics to focus on are:
And even then, only one paragraph of the Getting Started section points straight to it's Board Representation section, so really only one topic would be helpful. So I guess another reason for this blog series, is to provide aid to others who may not be shooting for making an engine themselves quite yet, and just want to focus on making a playable game of chess.
Where are we at the moment: To be completely transparent, if you have already somehow read my first post, I am already fairly deep into my chess game project. It virtually works as intended, but I need to create better documentation, as well as project history, for my chess library api (if I am misusing the terminology please forgive me, I am still a college student at the time of this writing). I have already decided on the board representation data structure I am using (it's not bitboards), I have move generation (I may have broken it in the build at the time of this writing), and move validation figured out. My next several blog posts will be my attempt to retrace my steps along my journey, to the current point of my project, starting with:
- My Board Representation
- Move Generation
- Move Validation
- Perft implementation
After which the blog posts will most likely alternate between the work done on my library api, and my chess gui implementation that uses that library. My next blog post will focus on the board representation and piece representation implementations that I looked into, considered and used.
Top comments (0)