Ruby Project: 21/Blackjack (Procedural Programming)

Click here to view this project on Github.

This is a procedural-programming implementation of 21 (Blackjack) written in Ruby. It runs in the command line and uses a deck that’s generated programmatically (four suits, thirteen ranks), deals random cards while removing them from the deck, and walks through a full game loop with a player turn (hit/stay) and a dealer turn (hit until 17). It also tracks score across rounds, and ends the game when either the player or dealer reaches 5 wins.

Skills demonstrated:

  •     Ruby
  •     Procedural programming
  •     Program decomposition (methods for deck creation, dealing, turns, scoring)
  •     Control flow (loops, conditionals, game loop state)
  •     Data structures (arrays, hashes, constants)
  •     Input validation and user prompts
  •     Game logic (hit/stay, dealer threshold, bust detection, winner calculation)
  •     State management (deck mutation, hand values, running score)

Leave a Reply

Your email address will not be published. Required fields are marked *