Flowchart
Flowchart
Main()
Import
random,
linecache
Set underArray =
length
Set jointWordLength =
length
Set guessArray =
(jointWordLength + 5)
Display The
length of the
word
is length, letter
s.
Display There
are jointWord
Length, differe
nt letters.
choice(word)
Display You
have 6
misguesses until
you lose.
length =
length(word)
While counter is in
range(0,
jointWordLength)
True
Display Enter in the dev
code to see the word or
press enter to skip:
False
Set guessTotal =
counter + error + 1
If counter =
jointWordLength
Display Please
input a single
letter:
Input code
Input guess
False
If code != apple
Display
Congratulatio
ns!! You have
correctly
guessed the
word word, in
guessTotal, tr
ies.
Set guess =
lowercase guess
Display,
word
True
Set guess, index =
guessMultipleCheck(guess,
allGuessCounter, guessArray, index, word)
restartValid()
End
If guessCount >=
1
True
False
guessCount = 1
True
False
Display Nice,
there
are guessCoun
t,guess, s.
Display
Nice, there
is guess,
restartValid()
Set allGuessCounter =
allGuessCounter + 1
Declare String
restart
errorDisplay(error,
word)
Display
Would you
like to play
again? (y/n)
underScore(word,
length, guess,
underArray)
Input restart
Display
Previous
guesses:
Display
guessArray
If restart == y or
restart == Y
True
False
Restart Program
Exit Program
guessMultipleCheck(String guess,
Integer allGuessCounter, String
guessArray, Integer index, String
word)
extreme_list(String
word)
Display You
have chosen
extreme
difficulty.
guess == 1 or
guess == or
guess ==
Display
Please input
a SINGLE
letter:
guessDuplicateCheck(g
uessArray, guess,
index, word,
allGuessCounter)
Display
Good Luck,
you re goint
to need it.
Input guess
Declare InputFile
wordDatabase
guessDuplicateCheck(String
guessArray, String guess, Integer
index, String word,
IntegerallGuessCounter)
Open wordDatabase
words_extreme.txt
guessArray.count(guess)
>=1 and index > 0
Read
wordDatabase
Display That
letter has
already been
guessed,
guessMultipleCheck(guess,
allGuessCounter,
guessArray, index, word)
Display
please
guess
another
Set allGuessCounter =
allGuessCpunter + 1
Close wordDatabase
Input guess
Return word
hard_list(String
word)
medium_list(String
word)
easy_list(String
word)
Display You
have chosen
hard
difficulty.
Display You
have chosen
medium
difficulty.
Display You
have chosen
easy
difficulty.
Display It is
not to be
taken
lightly.
Display This
is for the
average
player.
Display You
better not
lose.
Declare InputFile
wordDatabase
Declare InputFile
wordDatabase
Declare InputFile
wordDatabase
Open wordDatabase
words_hard.txt
Open wordDatabase
words_medium.txt
Open wordDatabase
words_easy.txt
Read
wordDatabase
Read
wordDatabase
Read
wordDatabase
Set word = word on
line chosen
depending on num
Close wordDatabase
Close wordDatabase
Close wordDatabase
Return word
Return word
Return word
guessIndexFinder(S
tring word, String
guess, Integer
length)
underScore(String word,
Integer length, String guess,
String underArray)
Index = length - 1
Index = length - 1
True
True
Set guess =
word[index]
Set guess =
word[index]
False
False
Set
underArray[index] =
guess
Set tempIndex =
index
Return tempIndex
Display
underArray
choice(String word):
Return
Display Please choose
a difficulty, (1)easy,
(2)medium, (3)hard,
(4)extreme:
Input dif
Easy_list(word)
True
dif = 1
False
medium_list(w
ord)
True
dif = 2
False
hard_list(word
)
True
dif = 3
False
Extreme_list(w
ord)
True
dif = 4
Return word
errorDisplay(Integer
error,String word)
Display
-------|
|
|
|
|
|
|
--------------
Display
-------|
|
0 |
|
|
|
|
--------------
Display
-------|
|
0 |
/
|
|
|
|
--------------
Display
-------|
|
0 |
/|\ |
| |
|
|
--------------
Display
-------|
|
0 |
/\ |
|
|
|
--------------
Display
-------|
|
0 |
/|\ |
| |
/
|
|
--------------
Display
Sorry, the
word
was word,
but you have
guessed
incorrectly
too many
times.
Display
-------|
|
0 |
/|\ |
| |
/\ |
|
--------------
restartValid()
Return