Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rem ***** Included Source File *****
- REM Set up a data list of place names.
- data "london", "glasgow", "glenrothes", "kirkcaldy"
- data "leven", "markinch", "lochgelly", "dunfermline"
- data "cupar", "cardenden", "kinglassie", "methill"
- data "cowdenbeath", "kelty", "crossgates", "kennoway"
- data "buckhaven", "newburgh", "auchtermuchty", "freuchie"
- REM Use the random function to pick a place name.
- randomize timer()
- wordposition=rnd(19)+1
- for loopcounter=1 to wordposition
- read word$
- next loopcounter
- REM Display the chosen place name and print a screen heading.
- print word$
- set cursor 300, 50
- print "HANGMAN"
- REM Draw the hangman structure
- line 60, 150, 150, 150
- line 60, 150, 60, 350
- line 150, 150, 150, 200
- box 50, 350, 150, 400
- REM Print a row of underscores
- lengthofword as integer
- lengthofword=len(word$)
- set cursor 200, 400
- for loopcounter=1 to lengthofword
- print " _";
- next loopcounter
- REM Ask the user to guess a letter
- outerloop=0
- while outerloop<lengthofword
- set cursor 200, 300
- ink rgb (0,255,0), 0
- input "Try a letter: ", letter$
- REM Compare the guess with each letter of the chosen place name and print any matches found
- set cursor 200,400
- for loopcounter=1 to lengthofword
- if letter$=mid$(word$, loopcounter)
- print " ", letter$;
- outerloop=outerloop+1
- else
- print " _";
- endif
- next loopcounter
- ink rgb (0,0,0), 0
- text 312, 300, letter$
- endwhile
- wait key
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement