Hey guys I am having some trouble getting my code organized and completed for my hangman project. I got some criticism from my instructor on my code and I'm confused on what I am missing. Here is what he said.
You have some major organization problems...
All variables and variable arrays should be declared in the variable declaration section.
Values are assigned in the assignment of value section
and finally in game processing you should have the title call, the gallows call, and the if statement to display the appropriate number of spaces. -3
You also have a gitem and a gitem$ -1
if li = 5 is not necessary because if it is not 3 or 4, it has to be 5. -1
You really need to go over the pseudo code and flow chart for this assignment. They lay the program out as it needs to be organized. make sure you correct these mistake before next week.
I have attached the pseudo code with this post as well to take a look at if you would like. I am also going to post up my code so far as well. I am very new at this so I am not sure where to go with this. If you could lend me a hand and point me in the right direction that would be great. Thanks
My code
`Hangman
cls
dim wordlist(12) as string
num as integer
gitem as string
li as integer
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"
randomize timer()
title()
gallows()
wait key
num = rnd(12)
gitem$ = wordlist(num)
li = len(gitem$)
if li = 3
threeSpace()
else
if li = 4
threeSpace()
fourSpace()
else
if li = 5
threeSpace()
fourSpace()
fiveSpace()
else
endif
endif
endif
dim itemletters(li) as string
for c = 1 to li
itemletters(c) = mid$(gitem$,c)
print itemletters(c)
next c
wait key
end
function title()
set text font "algerian"
set text size 36
ink rgb(0,255,0),0
text 120,40, "Welcome To Hang-Man!"
ink rgb(255,0,0),0
text 122,42, "Welcome To Hang-Man!"
set text size normal
ink rgb(0,255,0),0
endfunction
function gallows()
line 200,100,200,320
line 200,100,300,100
line 300,100,300,150
endfunction
function head()
circle 300,160,10
endfunction
function body()
line 300,172,300,210
endfunction
function rleg()
line 300,210,290,250
endfunction
function lleg()
line 300,210,310,250
endfunction
function rarm()
line 300,172,310,210
endfunction
function larm()
line 300,172,290,210
endfunction
function threeSpace()
line 100,400,130,400
line 150,400,180,400
line 200,400,230,400
endfunction
function fourSpace()
line 250,400,280,400
endfunction
function fiveSpace()
line 300,400,330,400
endfunction