Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. Rem ***** Included Source File *****
  2.  
  3. REM Set up a data list of place names.
  4. data "london", "glasgow", "glenrothes", "kirkcaldy"
  5. data "leven", "markinch", "lochgelly", "dunfermline"
  6. data "cupar", "cardenden", "kinglassie", "methill"
  7. data "cowdenbeath", "kelty", "crossgates", "kennoway"
  8. data "buckhaven", "newburgh", "auchtermuchty", "freuchie"
  9.  
  10.  
  11. REM Use the random function to pick a place name.
  12. randomize timer()
  13. wordposition=rnd(19)+1
  14.  
  15. for loopcounter=1 to wordposition
  16. read word$
  17. next loopcounter
  18.  
  19.  
  20. REM Display the chosen place name and print a screen heading.
  21. print word$
  22. set cursor 300, 50
  23. print "HANGMAN"
  24.  
  25.  
  26. REM Draw the hangman structure
  27. line 60, 150, 150, 150
  28. line 60, 150, 60, 350
  29. line 150, 150, 150, 200
  30. box 50, 350, 150, 400
  31.  
  32.  
  33. REM Print a row of underscores
  34. lengthofword as integer
  35. lengthofword=len(word$)
  36. set cursor 200, 400
  37.  
  38. for loopcounter=1 to lengthofword
  39. print " _";
  40. next loopcounter
  41.  
  42.  
  43. REM Ask the user to guess a letter
  44. outerloop=0
  45.  
  46. while outerloop<lengthofword
  47. set cursor 200, 300
  48. ink rgb (0,255,0), 0
  49. input "Try a letter: ", letter$
  50.  
  51.  
  52. REM Compare the guess with each letter of the chosen place name and print any matches found
  53. set cursor 200,400
  54. for loopcounter=1 to lengthofword
  55. if letter$=mid$(word$, loopcounter)
  56. print " ", letter$;
  57. outerloop=outerloop+1
  58. else
  59. print " _";
  60. endif
  61. next loopcounter
  62. ink rgb (0,0,0), 0
  63. text 312, 300, letter$
  64. endwhile
  65.  
  66.  
  67. wait key
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement