I've created a hangman game and I am trying to get it cleaned. I have very little programming experience so bare with me. In my game I need to get rid of the word that comes before guess. How can I do this without screwing up my game. I also would like to be able to to let the user know when they have already guessed a letter, as well as make it so only lower case letters are accepted. And how would I input this into my code. Also if you guys can think of anymore advice in order to clean the appearance of my game up that would be great. Thank you!
`Hangman
randomize timer()
startofprogram:
rem variable declaration section
dim wordlist(12) as string
dim itemletters(5) as string
num as integer
gitem as string
li as integer
found as string
Error as integer
guess as string
usedletters as integer
letterguess as integer
rem assignment of value section
wordlist(0) = "queen"
wordlist(1) = "sword"
wordlist(2) = "spear"
wordlist(3) = "noble"
wordlist(4) = "fire"
wordlist(5) = "fief"
wordlist(6) = "serf"
wordlist(7) = "moat"
wordlist(8) = "bows"
wordlist(9) = "sly"
wordlist(10) = "die"
wordlist(11) = "oat"
wordlist(12) = "spy"
cls
title()
gallows()
set text size 18
set text font "times new roman"
num = rnd(12)
gitem = wordlist(num)
li = len(gitem)
if li = 3
threeSpace()
else
if li = 4
threeSpace()
fourSpace()
else
threeSpace()
fourSpace()
fiveSpace()
endif
endif
for c = 1 to li
itemletters(c) = mid$(gitem, c)
printc itemletters(c)
next c
input "Guess a letter or press qq to quit: ", guess
while guess<> "qq"
found = "no"
if guess = itemletters(1)
text 135,425, guess
usedletters = usedletters + 1
found = "yes"
endif
if guess = itemletters(2)
text 185,425, guess
usedletters = usedletters + 1
found = "yes"
endif
if guess = itemletters(3)
text 235,425, guess
usedletters = usedletters + 1
found = "yes"
endif
if guess = itemletters(4)
text 285,425, guess
usedletters = usedletters + 1
found = "yes"
endif
if guess = itemletters(5)
text 335, 425, guess
usedletters = usedletters + 1
found = "yes"
endif
if usedletters = li
sleep 200
CLS
Winner()
sleep 1000
goto startofprogram
endif
if found = "no" and Error = 0
head()
Error = Error +1
else
if found = "no" and Error = 1
body()
Error = Error +1
else
if found = "no" and Error = 2
rleg()
Error = Error +1
else
if found = "no" and Error = 3
lleg()
Error = Error +1
else
if found = "no" and Error = 4
rarm()
Error = Error +1
else
if found = "no" and Error = 5
larm()
Error = Error +1
endif
endif
endif
endif
endif
endif
if Error = 6
sleep 200
cls
Lose()
sleep 1000
goto startofprogram
endif
input "Guess a letter or press QQ to quit: ", guess
endwhile
wait key
end
function title()
set text font "algerian"
set text size 32
ink rgb(255, 255, 255), 0
text 250, 80, "Welcome To Hang-Man!"
ink rgb(255, 0, 0), 0
text 252, 82, "Welcome To Hang-Man!"
set text size normal
ink rgb(255, 0, 0), 0
endfunction
function Winner()
set text font "algerian"
set text size 45
ink rgb(255,0,0),0
text 200,45, "You win!!! You win!!!"
ink rgb (0,0,255),0
text 201,46, "You win!!! You win!!!"
endfunction
function Lose()
set text font "algerian"
set text size 45
ink rgb(255,0,0),0
text 200,45, "You Lose!!!"
ink rgb (0,0,255),0
text 201,46, "You Lose!!!"
endfunction
function gallows()
line 225, 175, 225, 425
line 225, 175, 325, 175
line 325, 175, 325, 225
endfunction
function head()
circle 325, 240, 15
endfunction
function body()
line 325, 255, 325, 310
endfunction
function rleg()
line 325, 310, 300, 360
endfunction
function lleg()
line 325, 310, 350, 360
endfunction
function rarm()
line 325, 255, 300, 295
endfunction
function larm()
line 325, 255, 350, 245
endfunction
function threeSpace()
Line 125, 450, 150, 450
Line 175, 450, 200, 450
Line 225, 450, 250, 450
endfunction
function fourSpace()
Line 125, 450, 150, 450
Line 175, 450, 200, 450
Line 225, 450, 250, 450
Line 275, 450, 300, 450
endfunction
function fiveSpace()
Line 125, 450, 150, 450
Line 175, 450, 200, 450
Line 225, 450, 250, 450
Line 275, 450, 300, 450
Line 325, 450, 350, 450
endfunction
function LetterWrong(sLetter$)
bOutput as boolean = 1
for c = 1 to array count(itemletters(0))
if itemletters(c) = sLetter$
bOutput = 0
exit
endif
next c
endfunction bOutput
function HandleError(errors)
inc errors
select errors
case 1
head()
endcase
case 2
body()
endcase
case 3
rleg()
endcase
case 4
lleg()
endcase
case 5
rarm()
endcase
case 6
larm()
endcase
endselect
endfunction errors