bsale

rustjack

2 minutes

See the code that I am referring to on my Github.

Growing up, I loved the movie 21, a drama about a precocious math student who is recruited to join the MIT blackjack team. The movie is based off of the book Bringing Down the House, and, as usual, the book is better than the movie (once I read the book, of course).

In 2023, I took an interest in wanting to learn more about the Rust programming language and lower-level programming concepts more generally. Given the very object-oriented nature of the game of blackjack, I thought creating a card-counting game would be a fun way to get my hands dirty with some Rust. Enter rustjack.

At first, the goal of rustjack was simply to create a working blackjack text-based game in the console. This took a couple of hours, but actually materialized fairly quickly. Then, following the card-counting goal, I wanted the game to be as authentic as possible: instead of one deck being perpetually re-shuffled, there is a shoe, and that shoe gets reshuffled at a certain threshold of cards remaining.

The fun part about going through multiple interations/feature sets of the game was that I learned a lot about how code structure decisions can affect the “model” of the game that the code represents, and how new features potentially (adversely) affect that model of the game.

Ultimately, in order for the game to be the ultimate card-counting simulator in the console, it likely needs some more features such as writing a log of hands (results) to a file for analysis. This would allow for comparison to “optimal”/GTO play, especially in terms of bet sizing. Additionally, it would be fun to (optionally) prompt the player every X hands to check the current count of the shoe. This feature would be more along the idea of a proper card-counting “trainer” application. Way down the road, it would be fun to put a user interface on the app, but for now I think it has some charm in remaining to be a console text game.