Dunk Troll

Duncan Hall

Games Programmer

Blackjack using State Machines

Made using: C++ and Allegro 5

Platform: PC

Project duration: 1.5 months (year 2 of Programming Degree)

Date of completion: November 2015

Project code: Github

The goal of the project was to utilise Finite State Machines to implement a game of Blackjack.

As the conditions behind the dealer's play are fairly simple it doesn't warrant a full FSM solution so I decided to apply the FSM concepts via a game state manager that controlled all the game states e.g. menu, blackjack table etc. This approach allowed me to dynamically create game states and switch between states from within the states themselves. I also utilised an enumerated type for the state of the blackjack table e.g. getting bets, playing hand etc which worked in conjunction with a switch statement to execute only the code relevant to that stage of the game.

Copyright © 2018 Duncan Hall. All content and trademarks property of their respective owners.