Skip to content

fredRobson345/Hangman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hangman

Java & JSwing

Overview

This is a Java program that runs the common game Hangman. There are a limited number of words that can be chosen from but the user has the ability to select the dificulty of the program (easy, medium or hard), which will change the number of incorrect guesses that they have. The user can also choose what the maximum length of the word they want to guess to be, but this does not change the limit of the minimum length of 4.

About

This program uses the java import JSwing to create the basic UI. This UI uses buttons to transverse the different difficulties, word lengths and game screens. The three difficulties are easy, medium and hard; easy gives the user a total of 8 incorrect guesses, medium a total of 6 incorrect guesses and hard a total of 4 incorrect guesses. For each difficulty you are able to select a maximum word length of 10 letters with the minimum length always being 4 letters. A word is then randomly selected from an array, and the total number of letters are displayed on the game screen. When the user enters a letter into the text box, the letter is then identified and if it is in the word, the corresponding letters from the word are displayed, or if the letter is incorrect it is added to the the wrong letter list, displayed and a incorrect guess is taken from the users total. Once all the word is guessed correctly or all of the avaliable incorrect guesses are used, the user is shown the correct word and the game restarts on the same difficulty and word length. I have choosen to do it this way as a user is likely to want to play more than one game at a set difficulty.

Run the Program

To run this program. Run Start.java This is in the file path: "Hangman\src\main\java\com\fredd\code\main\Start.java"

Future

There is definetly a lot of changes that can be made, and I will be making in the future. I can refactor the code to condense it, for example each difficulty and number of incorrect guesses has an array containing all of the words, this means that there is 15 arrays and 5 different ones with 2 other identical ones, this is not memory and storage efficient.

Next Steps

  • Compress all arrays into 5 different set lengths, i.e. 6 words, 7 words etc.
  • Create classes of easy medium and hard difficulties which then can use the different arrays based on the choice of the user, instead of different files and multiple classes of each.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages