Results 1 to 2 of 2
  1. #1
    durdanto is offline Member
    Join Date
    Feb 2011
    Posts
    20
    Rep Power
    0

    Default trying to write a program for hangman word game

    Hello,
    I am trying to do this assignment but can not figure it:

    Programming Question :Hangman Game
    Word Hangman Game is simplified:
    1) The word to guess cannot have repeated letters
    2) The word to guess is not case sensitive
    3) The guessing player has 10 tries to find the letters.
    4) The player cannot guess the entire word in one shot. S/he must give one letter at a time.
    Recommended skeleton of the structure of your program:
    1) A player enters the word to guess. Remember a word can only have letters and no repeated letters
    2) 20 or so blank lines are printed to clear the word to guess from the screen, before guessing player
    starts.
    3) Guessing player (the other player) is shown with dashes (or stars) the number of letters in the
    word to guess. Your program also shows the number of guesses left as well as a list of the letters
    still not picked (See sample run at the end of this explanation)
    4) Guessing player is prompted for a letter.
    5) As long as the input is more than one character long, is not a letter or is a letter that was already
    tried, your program keeps prompting the user for input. Incorrect entries should not be counted as
    guesses.
    6) Once a valid letter is entered (based on the restrictions described in step 4), your program updates
    the list of letters still left to try by removing this letter from the list(again refer to the sample
    outputs), reduces the number of guesses left by one, and checks whether the letter is part of the
    word to guess. If it is, then replace the dash (or star) with the letter in the appropriate position.
    Steps 3 to 6 are repeated until the guessing player finds all of the letters in the word or reaches 10 guesses.
    7) Your program ends with a summary of the game (Again see sample outputs).

    Output should be the following:
    Output Sample #1

    OK Guessing Player ... turn around, while your friend enters the word to guess!
    Other Player - Enter your word (letters only, no repeated letters and not case sensitive):
    Snow
    ( ………………… 20 blank lines here to clear the screen …………)
    Word to date: **** (10 guess(es) left)
    Letters not tried yet: ABCDEFGHIJKLMNOPQRSTUVWXYZ
    Which letter should I check for? 1
    --> Not a valid request - either not a letter or already guesses.
    Which letter should I check for? s
    Word to date: S*** (9 guess(es) left)
    Letters not tried yet: ABCDEFGHIJKLMNOPQR-TUVWXYZ
    Which letter should I check for? a
    Word to date: S*** (8 guess(es) left)
    Letters not tried yet: -BCDEFGHIJKLMNOPQR-TUVWXYZ
    Which letter should I check for? S
    --> Not a valid request - either not a letter or already guesses.
    Which letter should I check for? b
    Word to date: S*** (7 guess(es) left)
    Letters not tried yet: --CDEFGHIJKLMNOPQR-TUVWXYZ
    Which letter should I check for? c
    Word to date: S*** (6 guess(es) left)
    Letters not tried yet: ---DEFGHIJKLMNOPQR-TUVWXYZ
    Which letter should I check for? h
    Word to date: S*** (5 guess(es) left)
    Letters not tried yet: ---DEFG-IJKLMNOPQR-TUVWXYZ
    Which letter should I check for? j
    Word to date: S*** (4 guess(es) left)
    Letters not tried yet: ---DEFG-I-KLMNOPQR-TUVWXYZ
    Which letter should I check for?L
    Word to date: S*** (3 guess(es) left)
    Letters not tried yet: ---DEFG-I-K-MNOPQR-TUVWXYZ
    Which letter should I check for? q
    Word to date: S*** (2 guess(es) left)
    Letters not tried yet: ---DEFG-I-K-MNOP-R-TUVWXYZ
    Which letter should I check for? e
    Word to date: S*** (1 guess(es) left)
    Letters not tried yet: ---D-FG-I-K-MNOP-R-TUVWXYZ
    Which letter should I check for? r
    ----------------------------------------------------
    Sorry you didn't find the mystery word!
    It was "SNOW"
    Goodbye ....

    Output Sample #2

    OK Guessing Player ... turn around, while your friend enters the word to guess!
    Other Player - Enter your word (letters only, no repeated letters and not case sensitive):
    abcde
    ( ………………… 20 blank lines here to clear the screen …………)
    Word to date: ***** (10 guess(es) left)
    Letters not tried yet: ABCDEFGHIJKLMNOPQRSTUVWXYZ
    Which letter should I check for? a
    Word to date: A**** (9 guess(es) left)
    Letters not tried yet: -BCDEFGHIJKLMNOPQRSTUVWXYZ
    Which letter should I check for? ab
    You entered more than one letter - one letter at a time please!
    Which letter should I check for? b
    Word to date: AB*** (8 guess(es) left)
    Letters not tried yet: --CDEFGHIJKLMNOPQRSTUVWXYZ
    Which letter should I check for? c
    Word to date: ABC** (7 guess(es) left)
    Letters not tried yet: ---DEFGHIJKLMNOPQRSTUVWXYZ
    Which letter should I check for? d
    Word to date: ABCD* (6 guess(es) left)
    Letters not tried yet: ----EFGHIJKLMNOPQRSTUVWXYZ
    Which letter should I check for? e
    ----------------------------------------------------
    Congratulations!!!
    You guessed the mystery word "ABCDE" in 5 guesses!
    Goodbye ....

    END of Program

    PLEASE HELP

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Similar Threads

  1. Hangman Game // HELP //
    By K-Scale in forum New To Java
    Replies: 4
    Last Post: 05-27-2010, 12:01 AM
  2. Hangman Game Help Please
    By 9tjh in forum New To Java
    Replies: 4
    Last Post: 12-04-2009, 03:19 AM
  3. Hangman Game..
    By iPetey in forum New To Java
    Replies: 4
    Last Post: 05-07-2009, 02:24 PM
  4. Need help with hangman game
    By kurt in forum New To Java
    Replies: 4
    Last Post: 04-25-2009, 06:47 PM
  5. Hangman Game
    By L23 in forum New To Java
    Replies: 8
    Last Post: 07-03-2008, 01:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •