thirteen example gameplay

If you haven't already heard of the game Thirteen, it's basically a card game where four players race to get rid of all their cards first by placing matching sequences of cards onto the main stack. I was inspired to write this game when my friends and I rented a cabin for a couple nights during winter break and would play hours of Thirteen.

The main feature/challenge of this project was figuring out how to code bots that could play Thirteen at a basic level. When you play Thirteen, you begin to pick up on some simple strategies like playing the longest sequence you can and getting rid of your worse cards first. We would all sort our hands at the beginning of the game and after every one of our turns. When it was time to put down a sequence, we would scan through our sorted hand and, for each card, determine if that card could be a part of the longest sequence we could play. Of course there are other more nuanced strategies like playing sequences in a way that allows you to play more sequences on your next turns, but I chose to stick to the simpler strategies of playing for the bot "AI" implementation.

Figuring out the algorithms for the bot was challenging and a lot of fun since I quickly realized that you could use recursion to check all the possible valid sequences you could play from your hand. Using recursion wasn't something I was very comfortable with, but after practicing it more in class, I felt ready to use it in this project. There were definitely frustrating times caused by a base case that was off by one or something but when it worked, it worked, and that was like magic to me!

I used C# in Visual Studio for this project, which I now realize was a bit overkill. VS was heavy but it made testing super nice and the LSP autocomplete was pretty smart. I found C# easy to pick up and work with, and I would like to develop more complex applications with it and .Net in the future.