š®Game āļøStrategy šChess š¤Algorithm š»Game Dev
Want to try the game first? Play the JavaScript version here. Source code available here.
Background
From my teenage years until now, Iāve kept an old BASIC book. Itās a translated version of āBASIC Computer Gamesā written by David H. Ahl. BASIC (Beginnerās All-purpose Symbolic Instruction Code) is an old programming language designed to be easy for beginners to use. It was probably easier to use than assembler or C. I remember later creating a text-based game where seven countries fought each other in turn-based combat. It was my first game that I was quite proud of, but Iāve since lost the source code.
The reason this is labeled as Volume 1 is that it doesnāt include all the games from the original that I recently looked up out of nostalgia. Perhaps the editorial team omitted some games during the translation into my native language. No Yahtzee! However, they seem to have faithfully transcribed the source code without typos. Since someone has uploaded these to GitHub, I was saved the trouble of retyping the source code for this review.
Opening this book brought back an old mystery from the depths of my memory. It was the source code for a game called Hexapawn. While other programs were difficult enough for me to understand, this one was particularly challenging.
Hexapawn
Letās first understand what this game is about. Itās a type of minichess. Minichess is a chess variant played on a board smaller than the standard 8x8 chessboard, usually with fewer pieces. The game becomes simpler and more concise than regular chess, and is often used for educational purposes or as a proof of concept. I recently created a minichess game with three different game modes.
As the name suggests, this game features 6 pawns, with two players each having 3. The goal is to either eliminate all of the opponentās pieces or reach the end of the board (the opponentās starting line) before they do.
The complete source code for Hexapawn from BASIC Computer Games can be found here. In this blog post, I wonāt review the entire code, but will focus on the parts that interest me.
... continue reading