![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2005
Posts: 3
Rep Power: 0
![]() |
Pseudocode
Dear Members
Can anyone help me with some pseudocode please? It is for a programme called hangman and eventually will be programed in Java! The hangman program has to hold words between 6-10 letters and the hangman pieces are made up of 9 parts! Here is my pseudocode so far. Player one Gets word. Set word 6 >= 10 letters. Set Hangman_piece = 9 Set word_marker to length of word Set guess_count = 0 While (guess_count <= 9) Do Prompt player two with word. Player two guesses letter in word. If letter in word = True Then Output letter in word marker. Increment correct guess count +1 Elseif letter in word = False Output screen message letter not in word. Increment incorrect guess count +1 Assemble hangman piece. EndIf Enddo If (guess count > 9) Then Display game over! Display all pieces of hangman Endif End |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
Please be more clear: what do you want to add?
|
|
|
|
|
|
#3 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#4 | |
|
Professional Programmer
|
Quote:
|
|
|
|
|
|
|
#5 |
|
Newbie
Join Date: Nov 2005
Posts: 3
Rep Power: 0
![]() |
I want the Pseudocode to show, when player 2 guesses a letter in the word, to show them if the letter is in that word. If it isnt then I want it to show that if the letter is incorrectly guessed, then part of the hangman will be displayed. I want some kind of loop so that player 2 can guess the letters in the word. The hangman pieces are made up of 9 bits so therefore, player 2 has only got 9 guesses to guess the word.
I am very new to pseudocode and not sure whether what ive done is correct. :o |
|
|
|
|
|
#6 | ||||
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Pseudocode is not a syntactically constrained thing. Pseudocode is an expression of your thoughts. Here is an example:
Quote:
Quote:
IF the guess is correct THEN do this ELSE do that. Alternatively, IF the guess is incorrect THEN do this ELSE do that. Now, you go ahead and fill in the "do this" and the "do that", which you've described. Quote:
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
||||
|
|
|
|
|
#7 |
|
Newbie
Join Date: Nov 2005
Posts: 3
Rep Power: 0
![]() |
Thanks for help and comments, I will now have another look at it.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|