For some reason, the strikes variable increases no matter if the guess is correct or not, and it is increased by some funky amounts. Anyone have any idea why?
remstart
-------- Project: State Hangman
-------- Created: 12/20/2005 6:51:28 PM
-------- Created by: Nigel Harden a.k.a. Krimzon DestinE
remend
randomize timer ()
`declare states
dim state$(50)
for x = 1 to 50
read state$(x)
next x
`pick random word
rndstate$ = state$(rnd(50))
`return amount of letters in word
statelen = len(rndstate$)
dim state(1,statelen)
`makes an `*` for a blank
blank$ = ""
for n = 1 to statelen
blank$ = blank$ + "*"
next n
`mistakes
strikes = 0
strikes$ = "STRIKES: "
`display
set text opaque:set text size 15
text 50,0, "UNITED STATES HANGMAN"
text 50,100, rndstate$
text 50,150, blank$
text 50,200, str$(mistakes)
`main loop
do
set cursor 50,50
input "Type a letter and press enter "; guess$
for letter = 1 to statelen
if mid$(rndstate$,letter) = guess$
blank$ = left$(blank$,letter-1) + mid$(rndstate$,letter) + right$(blank$,statelen-letter)
text 50,150, blank$
else
inc strikes, 1
text 50,200, strike$ + str$(strikes)
endif
next letter
sync
loop
wait key
`declare the states
data "alabama"
data "alaska"
data "arizona"
data "arkansas"
data "california"
data "colorado"
data "connecticut"
data "delaware"
data "florida"
data "georgia"
data "hawaii"
data "idaho"
data "illinois"
data "indiana"
data "iowa"
data "kansas"
data "kentucky"
data "louisiana"
data "maine"
data "maryland"
data "massachusetts"
data "michigan"
data "minnesota"
data "mississippi"
data "missouri"
data "montana"
data "nebraska"
data "nevada"
data "newhampshire"
data "newjersey"
data "newmeixco"
data "newyork"
data "northcarolina"
data "northdakota"
data "ohio"
data "oklahoma"
data "oregon"
data "pennsylvania"
data "rhodisland"
data "southcarolina"
data "southdakota"
data "tennessee"
data "texas"
data "utah"
data "vermont"
data "virginia"
data "washington"
data "westviriginia"
data "wisconsin"
data "wyoming"