Skip to content

Instantly share code, notes, and snippets.

@AndyObtiva
Last active December 25, 2024 21:25
Show Gist options
  • Save AndyObtiva/d6a0a56940756fadee878dc731e987fc to your computer and use it in GitHub Desktop.
Save AndyObtiva/d6a0a56940756fadee878dc731e987fc to your computer and use it in GitHub Desktop.

Glimmer Hangman Icon Glimmer Hangman 1.0.0

Gem Version

Hangman (word game) that runs on Mac, Windows, and Linux. Built with Ruby and Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library) using Application Scaffolding.

Implementation started at the RubyConf 2024 Hack Day Event for Glimmer DSL for LibUI, which was connected to the RubyConf 2024 workshop "How To Build Basic Desktop Applications in Ruby".

glimmer-dsl-libui-mac-hangman.gif

Setup

Assuming you have Ruby installed (standard MRI / CRuby).

Run:

gem install glimmer_hangman

Usage

Run:

glimmer_hangman

or just:

hangman

The goal of the game is to guess a word by typing letters on the keyboard one by one, with 10 guesses max.

As each letter is typed, the blanks are replaced with letters that gradually reveal the word being guessed if the typed letter is a correct part of the word, with multiple occurrences if any (e.g typing E shows E twice in a word that has it twice like RECOGNIZED).

correct guesses

Or otherwise, the drawing at the top shows more parts of the scene of execution by hanging if the typed letter is incorrect.

incorrect guesses

Also, typed letters show up at the bottom of the screen as green (correct) or (red) incorrect.

guessed letters

The game is won once the correct word is guessed completely.

guessed letters

The game is lost once the stick figure is fully hung (10 guessed letters are incorrect).

guessed letters

Restart game by:

  • Keyboard Shortcut: CMD+R on Mac or CTRL+R on Windows/Linux
  • Menu Item: Game -> Restart

Copyright

MIT

Copyright (c) 2024 Andy Maleh. See LICENSE.txt for further details.

--

Built with Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library)

Glimmer Hangman icon made by Freepik from www.flaticon.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment