Of Course You Did
September 25, 2023Of course I did. Of course I got derailed off the new project and have started a new new project. It was as inevitable as gravity. However it should be a quick project (see you in six months with a half-finished, barely-working prototype of what I want to build).
Some friends of mine did el Camino de Santiago a couple summers back. During their voyage they met a fellow traveller who taught them a card game called Kaboom, and they were hooked. They kept playing it over and over their trip and when they came to Madrid they brought it with them and we got addicted as well. It is simple enough to explain but hard to remember all the rules until you have played a few times, and then you get in the flow and are very concentrated. The project is to program that game with a few AIs to be able to play it on the computer.
Each player gets dealt four cards, which they set in front of them, face down and without looking at them, two closer to them and two further. Each player should then look at their two closest cards, memorize them, and set them back down on the table. The undealt cards are placed in a pile at the center and the top is placed face up on the table. Then in turns players can either get the card that is showing or get one from the pile and substitute for one of their cards if they want to. The idea is to have the least points, with each card valued normally except for jokers, which are zero, and red kings, which are minus one. If you discard a card you got from the pile, depending on the value you can perform an action:
- 7s and 8s allow you to look at one of your cards
- 9s and 10s allow you to look at one of your opponent cards
- Jacks let you exchange one of your cards for one of your opponent’s, without looking.
- Queen does the exchange and you can look at what you received.
- King lets you look at a pair of cards and decide whether you can exchange them.
Additionally, if anybody discards a card you know is on the table face down, you can tap it and discard that card. If the card is yours, nothing happens, you got rid of one of your cards and therefore of points. If the card is not yours, you give one of your cards to the opponent that had the card that coincided with the tapped one. If you tap and reveal a card that does not coincide, you get an extra card as punishment.
The game ends when a player gets rid of all their cards and it’s their turn again, or when an opponent claims Kaboom and it’s their turn again. Cards are then added as score and if you claimed Kaboom and won the round with five or less points, you get minus five points. If you claimed Kaboom but didn’t win or had more than five points, you get your points and five extra. Ties are a loss for the kaboomer.
I want to program it in Rust to learn more about the language and get used to it, partly because I really enjoy it and partly because it won’t look bad on a CV. I have already sorted out the graphics part, which is usually the most tedious bit of all: downloaded a bunch of images for cards and fought my way through using SDL in Rust. The rest is implementing all the game logic and crafting the AIs, which will be the most interesting part.