Code Monkey home page Code Monkey logo

c3projects--hangman's Introduction

Hangman

Breakfast

Create a hangman game that can be played from the Terminal.

The rules according to Wikipedia:

The word to guess is represented by a row of dashes, giving the number of letters. If the guessing player suggests a letter or number which occurs in the word, the other player writes it in all its correct positions. If the suggested letter or number does not occur in the word, the other player draws one element of the hanged man stick figure as a tally mark. The game is over when:

  • The guessing player completes the word, or guesses the whole word correctly
  • The other player completes the diagram:
|     _________
|     |/      |
|     |      (_)
|     |      \|/
|     |       |
|     |      / \
|     |
| ____|___ word: _ O _ D O _

To get the hang of gameplay, here is an online version to play

  • Between each guess, the board should be redrawn to the terminal output (Ascii art!).
  • Use classes to contain your game logic. You may be able to implement your solution using just one class, but consider how isolating related functionality into separate classes may increase your code's readability and maintainability (single responsibility principle).
  • You should be able to play your game by running it from ruby directly, as opposed to starting it in irb. We did this with Mastermind, so refer to it for reference.

Lunch

  • Display the letters that have already been guessed before each player guesses a new letter.
  • Use the colorze gem to make each piece of the hangman a different color.

Dinner

  • Ensure the user is not penalized for guessing the same letter more than once.
  • Allow the user to choose their difficulty level: higher levels will have words or phrases with more letters. You determine the specific logic that will deterine a low, medium, high level, for example.
  • Handle inappropriate user input. For example, what happens when a user enters an exclamation point.

c3projects--hangman's People

Contributors

jnf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.