MATLAB Blackjack Game

Spring 2024

Over the course of my Computing Concepts and Applications class, we learned about various MATLAB coding techniques such as vectors, arrays, logical expressions, conditional statements, loops, functions, and plotting (to name a few). For our final project, we were to apply the things we learned by coding anything we wanted, as long as it used the required techniques. Naturally, my group and I decided to code a blackjack game with a card counter, because why not? I was eager to take the lead on the main code since I was most familiar with blackjack and card counting, and I was the most excited to see this game come to life.

Over the course of my coding journey, I ran into a few fun bugs (as coders usually do), and I had a blast trying to figure out why my code refused to cooperate. The best part was when all of the code was complete, but one last bug that was causing error messages to populate when I hovered over our plot that printed at the end of the game. With the help of our TA, we found out that MATLAB already had a built-in-function called “deal” that the software was confusing with our user-defined function called “deal,” and the fix was as simple as changing the name of our user-defined function to “dealCard”. Who knew MATLAB had a built-in-function called “deal”?? I certainly did not.

After all was said and done, we ended up with a pretty cool blackjack game with a fully functioning card counter that also printed a table and graph to summarize the rounds your played. It was super fun to code, even when working out the kinks, and it was definitely worth the effort. I will likely be modifying it in the future to be even more casino-realistic!

Previous
Previous

Ying's Leather Things

Next
Next

Forging