Giter Site home page Giter Site logo

abdulwarissherzad / hangman-game Goto Github PK

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

The user tries to guess letters in * a secret word, and loses after 7 guesses that are not in the word.

Home Page: https://hangmanwordgame.com/?fca=1&success=0#/

Java 100.00%
hangman hangman-game hangman-in-java hangmangame

hangman-game's Introduction

Hang Mane Word Game

Static Badge

    • Static Badge

The user tries to guess letters in - a secret word list and loses after guesses that are not in the word. The - user guesses a letter by clicking a button whose text is that letter.

The remaining chance of guesses are calculated as follows:

Remaining chance = Number of the characters in the word / 2

For example;

Consider the random word is Compression Remaining chance = 11 / 2 This is equal to 5.5

You will round this number as 5

GUI of the Game

The Game contains a menu bar that contains two menu items File and Options.

1- File Menu Bar

  • New game option: will start a new game by selecting a random word from the word database. The word file is explained below.
  • Save game option: will save the current game. When the user selects the save game option, a file chooser appears in order to get the save file name. You will define your own save file format and save the file with *.sav extension.
  • Load game option: will load a saved game. When the user selects load game option, a file chooser appears. In this file chooser, you will add a filter for extension. This filter will extract *.sav files from other file formats.
  • Exit option: will quit the game, but before it will ask from user if s/he really wants to quit. Also, it's an offer to save the game.

2- Options Menu Bar

  • Option: A new frame should appear. In this frame, user can configure game properties, and it's the setting of the game.

HangMan GUI

Game GUI

HangMan Game GUI with Menu Bar

Menu Bar GUI

How to use it?

This application gets the words from a text file. This file contains β€œ*.db” extension. I was free to design my own database file. However, I have put at least 20 words into the database. When the game starts, the application will select a random word from the database. During gameplay, when the user clicks on one of the letters on the frame, the clicked button will be disabled in order to avoid using the same letter again. This rule is also valid for saved games.

Here is an example:

Assume that the word was Application.

  • User pressed on A letter. (This letter should become disabled.)
  • User pressed on L letter. (This letter should become disabled.)
  • User pressed on X letter. (This letter should become disabled.)
  • User pressed on O letter. (This letter should become disabled.)
  • User saved the game.
  • User loaded the same game.
  • At this point, A, L, X, O letters will be disabled.

If the user may guess what the word is, the application provides a text field to enter the word. If s/he is right, a dialog box appears, that indicates the player has won the game. Otherwise, the player has lost the game.

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

πŸš€ About Me

I'm a Java developer, and I graduated in 2021, Subsequently, I worked for one year at Neptune Company. Following that, I have continued to work independently 🦾πŸ”₯ on my own projects...

Authors

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.