Hangman

Hangman

A classic console word game built in C# with random word selection, input validation, and progressive ASCII art.

> GenreWord Game
> Engine.NET 10 / C#
> RoleSolo Developer
> StatusPrototype

About the Project

Hangman brings the classic word game to a focused console application. Each session selects a random term from a JSON dictionary. The player reveals letters while every incorrect guess advances the ASCII drawing by one stage.

The goal was to build a complete and easy-to-follow game loop: load a word, validate input, reveal matches, and reach an unambiguous win or loss state.

What I Built

  • Random word selection from an external dictionary.json
  • Dictionary deserialization with System.Text.Json
  • Case-insensitive letter input
  • Validation for empty and previously used guesses
  • Synchronized incorrect-guess count and ASCII drawing stages
  • Dedicated output for winning, losing, and a missing data file

Technical Structure

The selected word is represented by a character array filled with placeholders. After every guess, the game iterates over the word and replaces matching underscores with the guessed letter. Once the array no longer contains a placeholder, the round is complete.

The dictionary deliberately lives outside the source code. This makes it possible to extend or replace the available vocabulary without restructuring the application.

What I Learned

The project demonstrated how much even a small console game benefits from clearly defined states. Input, game logic, and presentation already form a complete loop. The next step would be separating these responsibilities into methods or classes, making the rules easier to test and features such as multiple rounds or difficulty levels easier to add.

Development Notes

The devlog covers the dictionary, character array, and progressive ASCII stages in more detail:

Hangman in C#: From JSON Dictionary to Playable Round