Hangman CLI

01 OverView

An CLI application of the classic game Hangman. Hangman is a game where the player is given a random word and the player has to guess the word within a limited number of attempts.

02 Objectives

  • Review the swift fundamentals to create Hangman in the command line interface

03 Skills

Swift

04 Technical Walkthrough

The Hangman CLI was a great refresher to practiced my Swift fundamentals. I loved the game as a child and it was a perfect opportunity to recreate the game in the command line interface. One of my obstacles was that I was running to an issue with the user guessing correctly with a letter and having that letter geenerate in the correct space for the word. I intially tried to loop through the characters within the string but I was having issues with this approach. My solution was to take the user input and convert that into an array where each letter has it own index. If the user guessed a letter correctly, there will be a loop to check where the word has the guessed input and take the index to placed correctly.

05 Demo

Below is a video walkthrough Hangman in the command line interface

Screen.Recording.2024-07-22.at.8.51.03.AM.mov