Skip to content

Instantly share code, notes, and snippets.

@kmandreza
kmandreza / Pseudocode
Created January 12, 2013 04:28
Using pseudocode, write a simple hangman game. The point of pseudocode is to represent the logical structureof a program without getting bogged down in the syntax of a particular language. For example, a program to select the largest integer from an array of integers might be written like this in pseudocode initialize max_so_far to the first ele…
# generate a word at random and store it in a variable
# display the length of the word to the user
# correct_guesses is less than the length of the word
# prompt the user to guess a letter
# if the guess is correct increment correct_guesses by 1
# if the guess is incorrect increment incorrect_guesses by 1
# and draw the next part of the hangman
# if the incorrect_guesses is greater than 8, tell the user
# they lost and exit the program
# if correct_guesses is equal to the length of the word, tell the user they won