Giter Club home page Giter Club logo

mahamshamail / hangman_java_console Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 12 KB

This is an application that mimics the famous childhood game, Hangman. This is a Command Line Interface (CLI) application that allows the user to play the game. The game is coded in the context of Object Oriented Programming. Thus it has meaningful classes with meaningful attributes. The game follows an inheritance hierarchy model. Enjoy!

Java 100.00%
game hangman object-oriented-programming java

hangman_java_console's Introduction

Hangman Game - Java Console

Detailed Specification

  • This is an application that mimics the famous childhood game, Hangman.
  • You can try a fancier version of Hangman online: https://www.coolmathgames.com/0-hangman
  • This is a Command Line Interface (CLI) application that allows the user to play the game.
  • The game is coded in the context of Object Oriented Programing. Thus it has meaningful classes with meaningful attributes.
  • The game follows an inheritance hierarchy model.
  • Applied Exception Handling where necessary.

See below a sample class diagram shell:

The Game

Step 1: Screen Launched

When the player launches the app, he/she is presented with the following options:

  • Start the game → lets player start the game
  • View the rules of the game → See rules about how to play the game

All screens have descriptive messages and/or prompts.

Please note, to create a more realistic game, a menu appears as follows: Start the game View the rules of the game - Note: When a user views the rules of the game, there is an option that allows them to go back to the main menu. Exit the game

Step 2: Choose a word category

After the user hits the start game option he or she is presented with a menu listing the word categories. The user is required to select a category. Each category will indicate the type of words that the user would have to guess when they actually start to play the game. For example, if Sports is the category presented and the user chose sports as their category, then all the words generated by the game for the user to guess would revolve around Sports. Each category contains a bank of words (MINIMUM 5). Note: These were modelled using Arrays.

Step 3: Inside Word Categories

  • Each category contains a bank of words (5 words per category). Note: The categories were modelled using Arrays.
  • Each category has a minimum 5 words which are randomized at runtime.
  • Each question represents a level. To win the game, the player must reach level 5 (ie: question 5); and, answer it correctly. Once you get “hung” at any level, you automatically lose the game.
  • The app displays which level the player is currently on.

Step 4: Showing the word with dashes

After the user selects the category that he or she wants to play, they should be presented with a display that indicates that they have started the game.

At each level, the game must randomly pull a word from the Category word bank for the user to guess.

When the game selects a word for the user to guess, the word should be represented using dashes (- symbol). For example: IRON MAN would be represented as: ---- --- PIZZA would be represented as: ----- SAMUEL L JACKSON would be represented as: ------ - -------

Step 5: Guessing the word, Letter Banks, Incorrect Letters

The user guesses the word by entering letters, one by one. The process is as follows: Enter a letter Game displays whether the word contains that letter If yes, then show what position in the word the letter appears If no, then let the user know Ask for another letter

Your game should display a “Letters Bank” section.

The Letters Bank Section represents the letters that have not been chosen and selected already.This should be displayed to the user at all times. Thus, when the game is initially run, the letters bank section would display all the letters from A to Z.

Once the user chooses a letter in the “Letters Bank” section, the said letter should be removed from the section.

If the user chooses a letter that is not in the “Letters Bank” section then the game should display an error message indicating that that specific word has already been chosen.

The user is only allowed to select letters that appear in the Letter Bank.

If the letter the user pressed is contained in the word that the game chose, then all occurrences of the letter should appear in the correct position of the word, on top of (or in replace of) the respective dashes.However, if the letter the user pressed is not contained in the word that the game chose, then the letter should appear in the “Incorrect Letters” section.

The “Incorrect Letters” section must display all the letters that were selected from the Letters Bank Section that did not match a letter in the word that the user is trying to guess.

Step 6: Give the player chances & drawing the hangman

In each level, the game should allow the user 10 chances to guess each word.

Every time the user chooses an incorrect letter in the word, their chances decrease as well as the game draws one element of the hanged man stick figure.

You may implement the graphics for these hangman images using simple text graphics. For example: https://gist.github.com/chrishorton/8510732aa9a80a03c829b09f12e20d9c

Step 7: Moving to a next level

Once the user figures out the word presented at any level he or she will advance to the subsequent level.

Please ensure that you display the current level to the user.

Step 8: Lose Conditions

The player loses the game if: They run out of chances; or They get “hung” in any level

After the player loses, display a YOU LOSE message and return the player to the main menu.

Step 9: Win Conditions

The player can only win the game if he or she correctly guesses the word of the last level. After the player wins, display a YOU WIN message, and return the player to the main menu.

hangman_java_console's People

Contributors

mahamshamail avatar

Watchers

 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.