home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / WordProcessors / BK-WW6E3.DMS / in.adf / Archive / WwRexx.lha / Hangman < prev    next >
Encoding:
Text File  |  1996-06-27  |  5.7 KB  |  280 lines

  1. /*    Hangman */
  2.  
  3.  
  4. OPTIONS RESULTS
  5.  
  6.  
  7. /* The Text */
  8. NumLines = 29
  9.  
  10. line0  = "Patriot Games"
  11. line0b = "Film"
  12. line0c = "Stars Harrison Ford"
  13.  
  14. Line1  = "Manhattan Murder Mystery"
  15. Line1b = "Film"
  16. Line1c = "Directed by Woody Allen"
  17.  
  18. Line2  = "Play It Again Sam"
  19. Line2b = "Film" 
  20. Line2c = "Directed by Woody Allen"
  21.  
  22. Line3  = "Roman Holiday"
  23. Line3b = "Film"
  24. Line3c = "Starring Audrey Hepburn"
  25.  
  26. line4  = "Blazing Saddles"
  27. line4b = "Film"
  28. line4c = "Directed by & starring Mel Brookes"
  29.  
  30. line5  = "A Night at the Opera"
  31. line5b = "Film"
  32. line5c = "Starring the Marx Brothers"
  33.  
  34. line6  = "Duck Soup"
  35. line6b = "Film"
  36. line6c = "Starring the Marx Brothers"
  37.  
  38. line7  = "Modern Times"
  39. line7b = "Film"
  40. line7c = "Starring Charlie Chaplin"
  41.  
  42. line8  = "Dead Ringers"
  43. line8b = "Film"
  44. line8c = "A David Cronenburg horror"
  45.  
  46. line9  = "Naked Lunch"
  47. line9b = "Film"
  48. line9c = "Based on the book by William Burroughs"
  49.  
  50. line10  = "Star Wars"
  51. line10b = "Film"
  52. line10c = "First in a space trilogy by George Lucas"
  53.  
  54. line11  = "Beetlejuice"
  55. line11b = "Film"
  56. line11c = "Don't say his name three times!!!"
  57.  
  58. line12  = "2010"
  59. line12b = "Film"
  60. line12c = "Follow up to 2001!!"
  61.  
  62. line13  = "1984"
  63. line13b = "Film"
  64. line13c = "George Orwell's vision, starring John Hurt"
  65.  
  66. line14  = "A Clockwork Orange"
  67. line14b = "Film"
  68. line14c = "Banned in the UK by its director"
  69.  
  70. line15  = "The Piano"
  71. line15b = "Film"
  72. line15c = "88 keys"
  73.  
  74. line16  = "Gone with the Wind"
  75. line16b = "Film"
  76. line16c = "Frankly, m'dear, I don't give a damn!"
  77.  
  78. line17  = "Taxi Driver"
  79. line17b = "Film"
  80. line17c = "Stars Robert de Niro"
  81.  
  82. line18  = "Breakfast at Tiffanys"
  83. line18b = "Film"
  84. line18c = "Features Holly Golightly singing Moon River"
  85.  
  86. line19  = "Terminator"
  87. line19b = "Film"
  88. line19c = "He'll be back!"
  89.  
  90. line20  = "Jurassic Park"
  91. line20b = "Film"
  92. line20c = "The Dinosaurs are back!"
  93.  
  94. line21  = "Golden Eye"
  95. line21b = "Film"
  96. line21c = "The first Bond film starring Pierce Brosnan"
  97.  
  98. line22  = "Braveheart"
  99. line22b = "Film"
  100. line22c = "Directed by Mel Gibson, and starring him as a Scotsman!"
  101.  
  102. line23  = "Schindler's List"
  103. line23b = "Film"
  104. line23c = "Won Stephen Spielberg his first Oscar as director"
  105.  
  106. line24  = "Jaws"
  107. line24b = "Film"
  108. line24c = "A fishy tale from Stephen Spielberg"
  109.  
  110. line25  = "The Godfather"
  111. line25b = "Film"
  112. line25c = "First in a trilogy from Francis Ford Coppola"
  113.  
  114. line26  = "Wayne's World"
  115. line26b = "Film"
  116. line26c = "Starring Mike Myers and Dana Carvey"
  117.  
  118. line27  = "Reservoir Dogs"
  119. line27b = "Film"
  120. line27c = "Violent film about some colourful people, by Quentin Tarantino"
  121.  
  122. line28  = "Top Gun"
  123. line28b = "Film"
  124. line28c = "Tom Cruise flies some planes"
  125.  
  126. line29  = "Naked Gun"
  127. line29b = "Film"
  128. line29c = "Stars Leslie Nielsen"
  129.  
  130.  
  131.  
  132. /* Main Program */
  133.  
  134.  
  135. New
  136. Address Value Result
  137.  
  138. Num = Randu(Time('S'))
  139. Num = Num * NumLines
  140. Num = Num % 1
  141. RandomLine = "Line" || Num
  142.  
  143. TheText = Value(RandomLine)
  144.  
  145. TextLength = Length(TheText)
  146.  
  147. Font NAME "Shannon Book" SIZE "20pt"
  148.  
  149. Gottext = ''
  150. NumLetters = 0
  151.  
  152. Do Num = 1 to TextLength
  153.     Letter = SubStr(TheText, Num, 1)
  154.     IF Letter = ' ' THEN
  155.         GotText = GotText || ' '
  156.     ELSE DO
  157.         GotText = GotText || 'X'
  158.         NumLetters = NumLetters + 1
  159.     END
  160. END
  161.  
  162. Text GotText
  163.  
  164. NewParagraph
  165. NewParagraph
  166. Font SIZE "10pt"
  167. Text 'Guessed letters: '
  168.  
  169. GotRight = 0
  170. GotWrong = 0
  171.  
  172. GET_LETTER:
  173. WizardReq TITLE "Hangman" LABEL "It's a" Value(RandomLine || b) LABEL "Enter a letter:" Textbox 1 "_Letter" BUTTON 1 "_OK" BUTTON 2 "_Guess phrase..." BUTTON 3 "_Clue..." BUTTON "-1" "_Give up"
  174. buttonpressed = Result
  175. IF buttonpressed = -1 THEN
  176.     SIGNAL DEAD
  177.  
  178. IF buttonpressed = 3 THEN DO
  179.     GotWrong = GotWrong + 1
  180.     RequestNotify PROMPT Value(RandomLine || c)
  181. END
  182.  
  183. IF buttonpressed = 2 THEN DO
  184.     WizardReq TITLE "Hangman" LABEL "Enter the phrase:" Textbox 1 "_Phrase" BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
  185.     IF Result = -1 THEN
  186.         SIGNAL GET_LETTER
  187.  
  188.     Wizard_GetTextBox 1
  189.     GuessedPhrase = Result
  190.     GuessedPhrase = Upper(GuessedPhrase)
  191.     Temp = Upper(TheText)
  192.  
  193.     IF GuessedPhrase ~= Temp THEN
  194.         SIGNAL DEAD
  195.     ELSE DO
  196.         RequestNotify "Well done! only" GotWrong "wrong guesses!"
  197.         Close FORCE
  198.         Exit
  199.     END
  200. END
  201.  
  202. IF buttonpressed = 1 THEN DO
  203. Wizard_GetTextBox 1
  204. Guess = Result
  205.  
  206. IF (Length(Guess)) > 1 THEN DO
  207.     RequestNotify PROMPT "One letter at a time, stupid!"
  208.     SIGNAL GET_LETTER
  209. END
  210.  
  211. IF Guess = "" THEN DO
  212.     RequestNotify PROMPT "Type a letter, thicky!"
  213.     SIGNAL GET_LETTER
  214. END
  215.  
  216. Position EOF
  217.  
  218. Font SIZE "10pt"
  219. TempText = Guess || " "
  220. Text TempText
  221.  
  222. Position SOF
  223.  
  224. Font SIZE "20pt"
  225. RightThisGo = 0
  226. Do Num = 1 to TextLength
  227.     Letter = SubStr(TheText, Num, 1)
  228.     ULetter = Upper(Letter)
  229.     UGuess = Upper(Guess)
  230.     If ULetter = UGuess THEN DO
  231.         Delete
  232.         Text Letter
  233.         GotRight = GotRight + 1
  234.         RightThisGo = 1
  235.     END
  236.     ELSE
  237.         Cursor Right
  238. END
  239.  
  240. IF RightThisGo = 0 THEN
  241.     GotWrong = GotWrong + 1
  242.  
  243. IF GotRight = NumLetters THEN DO
  244.     RequestNotify "Well done! only" GotWrong "wrong guesses!"
  245.     Close FORCE
  246.     Exit
  247. END
  248.  
  249. END
  250.  
  251. IF GotWrong = 1 THEN
  252.     DrawLine 1 "6.3in" "2.14in" "7.49in" "2.14in" "2pt"
  253. ELSE IF GotWrong = 2 THEN
  254.     DrawLine 1 "6.86in" "2.12in" "6.86in" "0.91in" "2pt"
  255. ELSE IF GotWrong = 3 THEN
  256.     DrawLine 1 "6.87in" "0.92in" "7.46in" "0.92in" "2pt"
  257. ELSE IF GotWrong = 4 THEN
  258.     DrawLine 1 "6.86in" "1.2in" "7.12in" "0.94in" "2pt"
  259. ELSE IF GotWrong = 5 THEN
  260.     DrawLine 1 "7.46in" "0.91in" "7.46in" "1.12in" "2pt"
  261. ELSE IF GotWrong = 6 THEN
  262.     DrawCircle 1 "7.32in" "1.07in" "0.26in" "Bright Red" "2pt"
  263. ELSE IF GotWrong = 7 THEN
  264.     DrawLine 1 "7.43in" "1.37in" "7.43in" "1.6in" "2pt"
  265. ELSE IF GotWrong = 8 THEN
  266.     DrawLine 1 "7.4in" "1.41in" "7.24in" "1.51in" "2pt"
  267. ELSE IF GotWrong = 9 THEN
  268.     DrawLine 1 "7.44in" "1.43in" "7.61in" "1.51in" "2pt"
  269. ELSE IF GotWrong = 10 THEN
  270.     DrawLine 1 "7.4in" "1.61in" "7.27in" "1.72in" "2pt"
  271. ELSE IF GotWrong = 11 THEN DO
  272.     DrawLine 1 "7.43in" "1.6in" "7.58in" "1.74in" "2pt"
  273. DEAD:
  274.     RequestNotify "You're dead!, it was '"TheText"'"
  275.     Close FORCE
  276.     Exit
  277. END
  278.  
  279. SIGNAL GET_LETTER
  280.