basic101 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (598) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -0
  3. data/.simplecov +1 -0
  4. data/.yardopts +7 -0
  5. data/Changelog.md +3 -0
  6. data/Gemfile +12 -0
  7. data/Gemfile.lock +75 -0
  8. data/LICENSE.md +9 -0
  9. data/README.md +193 -0
  10. data/Rakefile +14 -0
  11. data/VERSION +1 -0
  12. data/bin/basic101 +10 -0
  13. data/lib/basic101/abs_function.rb +19 -0
  14. data/lib/basic101/argument_checker.rb +61 -0
  15. data/lib/basic101/arguments.rb +32 -0
  16. data/lib/basic101/array_reference.rb +52 -0
  17. data/lib/basic101/asc_function.rb +17 -0
  18. data/lib/basic101/basic_array.rb +69 -0
  19. data/lib/basic101/basic_comparisons.rb +20 -0
  20. data/lib/basic101/basic_float.rb +48 -0
  21. data/lib/basic101/basic_integer.rb +48 -0
  22. data/lib/basic101/basic_math.rb +22 -0
  23. data/lib/basic101/basic_numeric.rb +96 -0
  24. data/lib/basic101/basic_object.rb +35 -0
  25. data/lib/basic101/basic_string.rb +85 -0
  26. data/lib/basic101/binary_operation.rb +32 -0
  27. data/lib/basic101/binary_operations.rb +26 -0
  28. data/lib/basic101/built_in_functions.rb +31 -0
  29. data/lib/basic101/chr_function.rb +17 -0
  30. data/lib/basic101/cos_function.rb +17 -0
  31. data/lib/basic101/data_statement.rb +24 -0
  32. data/lib/basic101/define_function_statement.rb +23 -0
  33. data/lib/basic101/dim_statement.rb +25 -0
  34. data/lib/basic101/else_statement.rb +22 -0
  35. data/lib/basic101/end_statement.rb +13 -0
  36. data/lib/basic101/endif_statement.rb +19 -0
  37. data/lib/basic101/errors.rb +50 -0
  38. data/lib/basic101/exp_function.rb +17 -0
  39. data/lib/basic101/for_stack.rb +48 -0
  40. data/lib/basic101/for_statement.rb +57 -0
  41. data/lib/basic101/function.rb +11 -0
  42. data/lib/basic101/function_call.rb +32 -0
  43. data/lib/basic101/function_identifier.rb +8 -0
  44. data/lib/basic101/functions.rb +39 -0
  45. data/lib/basic101/gosub_statement.rb +23 -0
  46. data/lib/basic101/goto_statement.rb +23 -0
  47. data/lib/basic101/identifier.rb +23 -0
  48. data/lib/basic101/identity.rb +18 -0
  49. data/lib/basic101/if_statement.rb +31 -0
  50. data/lib/basic101/input.rb +44 -0
  51. data/lib/basic101/input_reader.rb +55 -0
  52. data/lib/basic101/input_statement.rb +46 -0
  53. data/lib/basic101/int_function.rb +17 -0
  54. data/lib/basic101/left_function.rb +19 -0
  55. data/lib/basic101/len_function.rb +18 -0
  56. data/lib/basic101/let_statement.rb +24 -0
  57. data/lib/basic101/line.rb +32 -0
  58. data/lib/basic101/log_function.rb +17 -0
  59. data/lib/basic101/main.rb +24 -0
  60. data/lib/basic101/mid_function.rb +20 -0
  61. data/lib/basic101/negate_operation.rb +21 -0
  62. data/lib/basic101/next_statement.rb +34 -0
  63. data/lib/basic101/not_operation.rb +23 -0
  64. data/lib/basic101/null_prompt_delimeter.rb +12 -0
  65. data/lib/basic101/null_transcript.rb +20 -0
  66. data/lib/basic101/numeric_identifier.rb +16 -0
  67. data/lib/basic101/on_goto_statement.rb +29 -0
  68. data/lib/basic101/output.rb +73 -0
  69. data/lib/basic101/parser.rb +457 -0
  70. data/lib/basic101/power_operation.rb +24 -0
  71. data/lib/basic101/print_comma.rb +20 -0
  72. data/lib/basic101/print_semicolon.rb +19 -0
  73. data/lib/basic101/print_statement.rb +33 -0
  74. data/lib/basic101/program.rb +100 -0
  75. data/lib/basic101/program_counter.rb +52 -0
  76. data/lib/basic101/prompt_delimeter.rb +13 -0
  77. data/lib/basic101/randomize_statement.rb +13 -0
  78. data/lib/basic101/read_statement.rb +25 -0
  79. data/lib/basic101/reference.rb +25 -0
  80. data/lib/basic101/remark_statement.rb +12 -0
  81. data/lib/basic101/restore_statement.rb +23 -0
  82. data/lib/basic101/return_statement.rb +16 -0
  83. data/lib/basic101/right_function.rb +19 -0
  84. data/lib/basic101/rnd_function.rb +24 -0
  85. data/lib/basic101/runtime.rb +132 -0
  86. data/lib/basic101/scalar_reference.rb +19 -0
  87. data/lib/basic101/sgn_function.rb +17 -0
  88. data/lib/basic101/sin_function.rb +17 -0
  89. data/lib/basic101/sqr_function.rb +17 -0
  90. data/lib/basic101/statement.rb +36 -0
  91. data/lib/basic101/stop_statement.rb +14 -0
  92. data/lib/basic101/str_function.rb +16 -0
  93. data/lib/basic101/string_identifier.rb +16 -0
  94. data/lib/basic101/tab.rb +18 -0
  95. data/lib/basic101/tab_function.rb +17 -0
  96. data/lib/basic101/tan_function.rb +17 -0
  97. data/lib/basic101/transcript.rb +37 -0
  98. data/lib/basic101/transform.rb +264 -0
  99. data/lib/basic101/user_defined_function.rb +54 -0
  100. data/lib/basic101/val_function.rb +16 -0
  101. data/lib/basic101.rb +93 -0
  102. data/rake_tasks/default.rake +1 -0
  103. data/rake_tasks/integration.rake +8 -0
  104. data/rake_tasks/jeweler.rake +28 -0
  105. data/rake_tasks/spec.rake +8 -0
  106. data/rake_tasks/test.rake +2 -0
  107. data/rake_tasks/yard.rake +3 -0
  108. data/test/integration/arguments.rb +25 -0
  109. data/test/integration/errors.rb +7 -0
  110. data/test/integration/integration_test.rb +28 -0
  111. data/test/integration/main.rb +49 -0
  112. data/test/integration/output_file.rb +40 -0
  113. data/test/integration/test.rb +135 -0
  114. data/test/integration/tests/basic_computer_games/23-match.bas +64 -0
  115. data/test/integration/tests/basic_computer_games/23-match.input +1 -0
  116. data/test/integration/tests/basic_computer_games/23-match.output +29 -0
  117. data/test/integration/tests/basic_computer_games/3dplot.bas +17 -0
  118. data/test/integration/tests/basic_computer_games/3dplot.input +0 -0
  119. data/test/integration/tests/basic_computer_games/3dplot.output +47 -0
  120. data/test/integration/tests/basic_computer_games/aceyducy.bas +100 -0
  121. data/test/integration/tests/basic_computer_games/aceyducy.input +8 -0
  122. data/test/integration/tests/basic_computer_games/aceyducy.output +78 -0
  123. data/test/integration/tests/basic_computer_games/amazing.bas +138 -0
  124. data/test/integration/tests/basic_computer_games/amazing.input +1 -0
  125. data/test/integration/tests/basic_computer_games/amazing.output +32 -0
  126. data/test/integration/tests/basic_computer_games/animal.bas +71 -0
  127. data/test/integration/tests/basic_computer_games/animal.input +17 -0
  128. data/test/integration/tests/basic_computer_games/animal.output +38 -0
  129. data/test/integration/tests/basic_computer_games/awari.bas +70 -0
  130. data/test/integration/tests/basic_computer_games/awari.input +11 -0
  131. data/test/integration/tests/basic_computer_games/awari.output +117 -0
  132. data/test/integration/tests/basic_computer_games/bagels.bas +81 -0
  133. data/test/integration/tests/basic_computer_games/bagels.input +12 -0
  134. data/test/integration/tests/basic_computer_games/bagels.output +42 -0
  135. data/test/integration/tests/basic_computer_games/banner.bas +94 -0
  136. data/test/integration/tests/basic_computer_games/banner.input +6 -0
  137. data/test/integration/tests/basic_computer_games/banner.output +135 -0
  138. data/test/integration/tests/basic_computer_games/basketbl.bas +196 -0
  139. data/test/integration/tests/basic_computer_games/basketbl.input +46 -0
  140. data/test/integration/tests/basic_computer_games/basketbl.output +509 -0
  141. data/test/integration/tests/basic_computer_games/batnum.bas +90 -0
  142. data/test/integration/tests/basic_computer_games/batnum.input +14 -0
  143. data/test/integration/tests/basic_computer_games/batnum.output +67 -0
  144. data/test/integration/tests/basic_computer_games/battle.bas +196 -0
  145. data/test/integration/tests/basic_computer_games/battle.input +21 -0
  146. data/test/integration/tests/basic_computer_games/battle.output +118 -0
  147. data/test/integration/tests/basic_computer_games/blackjck.bas +321 -0
  148. data/test/integration/tests/basic_computer_games/blackjck.input +26 -0
  149. data/test/integration/tests/basic_computer_games/blackjck.output +144 -0
  150. data/test/integration/tests/basic_computer_games/bombard.bas +93 -0
  151. data/test/integration/tests/basic_computer_games/bombard.input +20 -0
  152. data/test/integration/tests/basic_computer_games/bombard.output +175 -0
  153. data/test/integration/tests/basic_computer_games/bounce.bas +53 -0
  154. data/test/integration/tests/basic_computer_games/bounce.input +0 -0
  155. data/test/integration/tests/basic_computer_games/bounce.output +15 -0
  156. data/test/integration/tests/basic_computer_games/bowling.bas +101 -0
  157. data/test/integration/tests/basic_computer_games/bowling.input +23 -0
  158. data/test/integration/tests/basic_computer_games/bowling.output +229 -0
  159. data/test/integration/tests/basic_computer_games/boxing.bas +142 -0
  160. data/test/integration/tests/basic_computer_games/boxing.input +8 -0
  161. data/test/integration/tests/basic_computer_games/boxing.output +47 -0
  162. data/test/integration/tests/basic_computer_games/bug.bas +256 -0
  163. data/test/integration/tests/basic_computer_games/bug.input +17 -0
  164. data/test/integration/tests/basic_computer_games/bug.output +847 -0
  165. data/test/integration/tests/basic_computer_games/bullfght.bas +193 -0
  166. data/test/integration/tests/basic_computer_games/bullfght.input +4 -0
  167. data/test/integration/tests/basic_computer_games/bullfght.output +60 -0
  168. data/test/integration/tests/basic_computer_games/bullseye.bas +37 -0
  169. data/test/integration/tests/basic_computer_games/bullseye.input +10 -0
  170. data/test/integration/tests/basic_computer_games/bullseye.output +79 -0
  171. data/test/integration/tests/basic_computer_games/bunny.bas +40 -0
  172. data/test/integration/tests/basic_computer_games/bunny.input +0 -0
  173. data/test/integration/tests/basic_computer_games/bunny.output +67 -0
  174. data/test/integration/tests/basic_computer_games/buzzword.bas +25 -0
  175. data/test/integration/tests/basic_computer_games/buzzword.input +4 -0
  176. data/test/integration/tests/basic_computer_games/buzzword.output +25 -0
  177. data/test/integration/tests/basic_computer_games/calendar.bas +58 -0
  178. data/test/integration/tests/basic_computer_games/calendar.input +0 -0
  179. data/test/integration/tests/basic_computer_games/calendar.output +213 -0
  180. data/test/integration/tests/basic_computer_games/change.bas +51 -0
  181. data/test/integration/tests/basic_computer_games/change.input +4 -0
  182. data/test/integration/tests/basic_computer_games/change.output +28 -0
  183. data/test/integration/tests/basic_computer_games/checkers.bas +82 -0
  184. data/test/integration/tests/basic_computer_games/checkers.input +74 -0
  185. data/test/integration/tests/basic_computer_games/checkers.output +673 -0
  186. data/test/integration/tests/basic_computer_games/chemist.bas +27 -0
  187. data/test/integration/tests/basic_computer_games/chemist.input +11 -0
  188. data/test/integration/tests/basic_computer_games/chemist.output +54 -0
  189. data/test/integration/tests/basic_computer_games/chief.bas +51 -0
  190. data/test/integration/tests/basic_computer_games/chief.input +5 -0
  191. data/test/integration/tests/basic_computer_games/chief.output +19 -0
  192. data/test/integration/tests/basic_computer_games/chomp.bas +104 -0
  193. data/test/integration/tests/basic_computer_games/chomp.input +15 -0
  194. data/test/integration/tests/basic_computer_games/chomp.output +159 -0
  195. data/test/integration/tests/basic_computer_games/combat.bas +124 -0
  196. data/test/integration/tests/basic_computer_games/combat.input +7 -0
  197. data/test/integration/tests/basic_computer_games/combat.output +33 -0
  198. data/test/integration/tests/basic_computer_games/craps.bas +82 -0
  199. data/test/integration/tests/basic_computer_games/craps.input +9 -0
  200. data/test/integration/tests/basic_computer_games/craps.output +51 -0
  201. data/test/integration/tests/basic_computer_games/cube.bas +161 -0
  202. data/test/integration/tests/basic_computer_games/cube.input +25 -0
  203. data/test/integration/tests/basic_computer_games/cube.output +72 -0
  204. data/test/integration/tests/basic_computer_games/depthchg.bas +33 -0
  205. data/test/integration/tests/basic_computer_games/depthchg.input +16 -0
  206. data/test/integration/tests/basic_computer_games/depthchg.output +83 -0
  207. data/test/integration/tests/basic_computer_games/diamond.bas +27 -0
  208. data/test/integration/tests/basic_computer_games/diamond.input +1 -0
  209. data/test/integration/tests/basic_computer_games/diamond.output +65 -0
  210. data/test/integration/tests/basic_computer_games/dice.bas +31 -0
  211. data/test/integration/tests/basic_computer_games/dice.input +4 -0
  212. data/test/integration/tests/basic_computer_games/dice.output +46 -0
  213. data/test/integration/tests/basic_computer_games/digits.bas +78 -0
  214. data/test/integration/tests/basic_computer_games/digits.input +5 -0
  215. data/test/integration/tests/basic_computer_games/digits.output +70 -0
  216. data/test/integration/tests/basic_computer_games/evenwin1.bas +128 -0
  217. data/test/integration/tests/basic_computer_games/evenwin1.input +13 -0
  218. data/test/integration/tests/basic_computer_games/evenwin1.output +116 -0
  219. data/test/integration/tests/basic_computer_games/evenwin2.bas +70 -0
  220. data/test/integration/tests/basic_computer_games/evenwin2.input +14 -0
  221. data/test/integration/tests/basic_computer_games/evenwin2.output +56 -0
  222. data/test/integration/tests/basic_computer_games/flipflop.bas +79 -0
  223. data/test/integration/tests/basic_computer_games/flipflop.input +8 -0
  224. data/test/integration/tests/basic_computer_games/flipflop.output +45 -0
  225. data/test/integration/tests/basic_computer_games/footbal1.bas +298 -0
  226. data/test/integration/tests/basic_computer_games/footbal1.input +13 -0
  227. data/test/integration/tests/basic_computer_games/footbal1.output +315 -0
  228. data/test/integration/tests/basic_computer_games/footbal2.bas +181 -0
  229. data/test/integration/tests/basic_computer_games/footbal2.input +23 -0
  230. data/test/integration/tests/basic_computer_games/footbal2.output +318 -0
  231. data/test/integration/tests/basic_computer_games/furtradr.bas +170 -0
  232. data/test/integration/tests/basic_computer_games/furtradr.input +20 -0
  233. data/test/integration/tests/basic_computer_games/furtradr.output +133 -0
  234. data/test/integration/tests/basic_computer_games/golf.bas +244 -0
  235. data/test/integration/tests/basic_computer_games/golf.input +11 -0
  236. data/test/integration/tests/basic_computer_games/golf.output +69 -0
  237. data/test/integration/tests/basic_computer_games/gomoko.bas +54 -0
  238. data/test/integration/tests/basic_computer_games/gomoko.input +6 -0
  239. data/test/integration/tests/basic_computer_games/gomoko.output +66 -0
  240. data/test/integration/tests/basic_computer_games/guess.bas +40 -0
  241. data/test/integration/tests/basic_computer_games/guess.input +8 -0
  242. data/test/integration/tests/basic_computer_games/guess.output +37 -0
  243. data/test/integration/tests/basic_computer_games/gunner.bas +52 -0
  244. data/test/integration/tests/basic_computer_games/gunner.input +18 -0
  245. data/test/integration/tests/basic_computer_games/gunner.output +91 -0
  246. data/test/integration/tests/basic_computer_games/hamurabi.bas +119 -0
  247. data/test/integration/tests/basic_computer_games/hamurabi.input +7 -0
  248. data/test/integration/tests/basic_computer_games/hamurabi.output +51 -0
  249. data/test/integration/tests/basic_computer_games/hangman.bas +81 -0
  250. data/test/integration/tests/basic_computer_games/hangman.input +69 -0
  251. data/test/integration/tests/basic_computer_games/hangman.output +889 -0
  252. data/test/integration/tests/basic_computer_games/hello.bas +83 -0
  253. data/test/integration/tests/basic_computer_games/hello.input +7 -0
  254. data/test/integration/tests/basic_computer_games/hello.output +46 -0
  255. data/test/integration/tests/basic_computer_games/hexapawn.bas +174 -0
  256. data/test/integration/tests/basic_computer_games/hexapawn.input +38 -0
  257. data/test/integration/tests/basic_computer_games/hexapawn.output +521 -0
  258. data/test/integration/tests/basic_computer_games/hi-q.bas +135 -0
  259. data/test/integration/tests/basic_computer_games/hi-q.input +14 -0
  260. data/test/integration/tests/basic_computer_games/hi-q.output +115 -0
  261. data/test/integration/tests/basic_computer_games/hilo.bas +29 -0
  262. data/test/integration/tests/basic_computer_games/hilo.input +20 -0
  263. data/test/integration/tests/basic_computer_games/hilo.output +76 -0
  264. data/test/integration/tests/basic_computer_games/hockey.bas +210 -0
  265. data/test/integration/tests/basic_computer_games/hockey.input +59 -0
  266. data/test/integration/tests/basic_computer_games/hockey.output +243 -0
  267. data/test/integration/tests/basic_computer_games/horsrace.bas +130 -0
  268. data/test/integration/tests/basic_computer_games/horsrace.input +11 -0
  269. data/test/integration/tests/basic_computer_games/horsrace.output +517 -0
  270. data/test/integration/tests/basic_computer_games/hurkle.bas +51 -0
  271. data/test/integration/tests/basic_computer_games/hurkle.input +16 -0
  272. data/test/integration/tests/basic_computer_games/hurkle.output +81 -0
  273. data/test/integration/tests/basic_computer_games/kinema.bas +34 -0
  274. data/test/integration/tests/basic_computer_games/kinema.input +9 -0
  275. data/test/integration/tests/basic_computer_games/kinema.output +64 -0
  276. data/test/integration/tests/basic_computer_games/king.bas +268 -0
  277. data/test/integration/tests/basic_computer_games/king.input +7 -0
  278. data/test/integration/tests/basic_computer_games/king.output +57 -0
  279. data/test/integration/tests/basic_computer_games/lem.bas +246 -0
  280. data/test/integration/tests/basic_computer_games/lem.input +4 -0
  281. data/test/integration/tests/basic_computer_games/lem.output +68 -0
  282. data/test/integration/tests/basic_computer_games/letter.bas +26 -0
  283. data/test/integration/tests/basic_computer_games/letter.input +24 -0
  284. data/test/integration/tests/basic_computer_games/letter.output +123 -0
  285. data/test/integration/tests/basic_computer_games/life.bas +66 -0
  286. data/test/integration/tests/basic_computer_games/life.input +4 -0
  287. data/test/integration/tests/basic_computer_games/life.options +1 -0
  288. data/test/integration/tests/basic_computer_games/life.output +200 -0
  289. data/test/integration/tests/basic_computer_games/life2.bas +83 -0
  290. data/test/integration/tests/basic_computer_games/life2.input +17 -0
  291. data/test/integration/tests/basic_computer_games/life2.output +113 -0
  292. data/test/integration/tests/basic_computer_games/litquiz.bas +49 -0
  293. data/test/integration/tests/basic_computer_games/litquiz.input +4 -0
  294. data/test/integration/tests/basic_computer_games/litquiz.output +36 -0
  295. data/test/integration/tests/basic_computer_games/love.bas +34 -0
  296. data/test/integration/tests/basic_computer_games/love.input +1 -0
  297. data/test/integration/tests/basic_computer_games/love.output +67 -0
  298. data/test/integration/tests/basic_computer_games/lunar.bas +48 -0
  299. data/test/integration/tests/basic_computer_games/lunar.input +87 -0
  300. data/test/integration/tests/basic_computer_games/lunar.output +195 -0
  301. data/test/integration/tests/basic_computer_games/mastrmnd.bas +232 -0
  302. data/test/integration/tests/basic_computer_games/mastrmnd.input +18 -0
  303. data/test/integration/tests/basic_computer_games/mastrmnd.output +67 -0
  304. data/test/integration/tests/basic_computer_games/mathdice.bas +60 -0
  305. data/test/integration/tests/basic_computer_games/mathdice.input +4 -0
  306. data/test/integration/tests/basic_computer_games/mathdice.output +86 -0
  307. data/test/integration/tests/basic_computer_games/mugwump.bas +56 -0
  308. data/test/integration/tests/basic_computer_games/mugwump.input +16 -0
  309. data/test/integration/tests/basic_computer_games/mugwump.output +139 -0
  310. data/test/integration/tests/basic_computer_games/name.bas +25 -0
  311. data/test/integration/tests/basic_computer_games/name.input +2 -0
  312. data/test/integration/tests/basic_computer_games/name.output +22 -0
  313. data/test/integration/tests/basic_computer_games/nicoma.bas +34 -0
  314. data/test/integration/tests/basic_computer_games/nicoma.input +8 -0
  315. data/test/integration/tests/basic_computer_games/nicoma.output +36 -0
  316. data/test/integration/tests/basic_computer_games/nim.bas +156 -0
  317. data/test/integration/tests/basic_computer_games/nim.input +8 -0
  318. data/test/integration/tests/basic_computer_games/nim.output +30 -0
  319. data/test/integration/tests/basic_computer_games/number.bas +37 -0
  320. data/test/integration/tests/basic_computer_games/number.input +19 -0
  321. data/test/integration/tests/basic_computer_games/number.output +73 -0
  322. data/test/integration/tests/basic_computer_games/onecheck.bas +86 -0
  323. data/test/integration/tests/basic_computer_games/onecheck.input +6 -0
  324. data/test/integration/tests/basic_computer_games/onecheck.output +77 -0
  325. data/test/integration/tests/basic_computer_games/orbit.bas +96 -0
  326. data/test/integration/tests/basic_computer_games/orbit.input +10 -0
  327. data/test/integration/tests/basic_computer_games/orbit.output +113 -0
  328. data/test/integration/tests/basic_computer_games/pizza.bas +68 -0
  329. data/test/integration/tests/basic_computer_games/pizza.input +10 -0
  330. data/test/integration/tests/basic_computer_games/pizza.output +93 -0
  331. data/test/integration/tests/basic_computer_games/poetry.bas +42 -0
  332. data/test/integration/tests/basic_computer_games/poetry.input +0 -0
  333. data/test/integration/tests/basic_computer_games/poetry.options +1 -0
  334. data/test/integration/tests/basic_computer_games/poetry.output +50 -0
  335. data/test/integration/tests/basic_computer_games/poker.bas +416 -0
  336. data/test/integration/tests/basic_computer_games/poker.input +34 -0
  337. data/test/integration/tests/basic_computer_games/poker.output +197 -0
  338. data/test/integration/tests/basic_computer_games/queen.bas +168 -0
  339. data/test/integration/tests/basic_computer_games/queen.input +10 -0
  340. data/test/integration/tests/basic_computer_games/queen.output +133 -0
  341. data/test/integration/tests/basic_computer_games/reverse.bas +62 -0
  342. data/test/integration/tests/basic_computer_games/reverse.input +12 -0
  343. data/test/integration/tests/basic_computer_games/reverse.output +79 -0
  344. data/test/integration/tests/basic_computer_games/rocket.bas +71 -0
  345. data/test/integration/tests/basic_computer_games/rocket.input +42 -0
  346. data/test/integration/tests/basic_computer_games/rocket.output +149 -0
  347. data/test/integration/tests/basic_computer_games/rocksp.bas +33 -0
  348. data/test/integration/tests/basic_computer_games/rocksp.input +9 -0
  349. data/test/integration/tests/basic_computer_games/rocksp.output +69 -0
  350. data/test/integration/tests/basic_computer_games/roulette.bas +239 -0
  351. data/test/integration/tests/basic_computer_games/roulette.input +9 -0
  352. data/test/integration/tests/basic_computer_games/roulette.output +98 -0
  353. data/test/integration/tests/basic_computer_games/rusrou.bas +26 -0
  354. data/test/integration/tests/basic_computer_games/rusrou.input +9 -0
  355. data/test/integration/tests/basic_computer_games/rusrou.output +50 -0
  356. data/test/integration/tests/basic_computer_games/salvo.bas +329 -0
  357. data/test/integration/tests/basic_computer_games/salvo.input +21 -0
  358. data/test/integration/tests/basic_computer_games/salvo.output +49 -0
  359. data/test/integration/tests/basic_computer_games/sinewave.bas +17 -0
  360. data/test/integration/tests/basic_computer_games/sinewave.input +0 -0
  361. data/test/integration/tests/basic_computer_games/sinewave.output +168 -0
  362. data/test/integration/tests/basic_computer_games/slalom.bas +165 -0
  363. data/test/integration/tests/basic_computer_games/slalom.input +20 -0
  364. data/test/integration/tests/basic_computer_games/slalom.output +122 -0
  365. data/test/integration/tests/basic_computer_games/slots.bas +134 -0
  366. data/test/integration/tests/basic_computer_games/slots.input +2 -0
  367. data/test/integration/tests/basic_computer_games/slots.output +20 -0
  368. data/test/integration/tests/basic_computer_games/splat.bas +128 -0
  369. data/test/integration/tests/basic_computer_games/splat.input +9 -0
  370. data/test/integration/tests/basic_computer_games/splat.output +61 -0
  371. data/test/integration/tests/basic_computer_games/stars.bas +54 -0
  372. data/test/integration/tests/basic_computer_games/stars.input +15 -0
  373. data/test/integration/tests/basic_computer_games/stars.output +70 -0
  374. data/test/integration/tests/basic_computer_games/stock.bas +232 -0
  375. data/test/integration/tests/basic_computer_games/stock.input +30 -0
  376. data/test/integration/tests/basic_computer_games/stock.output +156 -0
  377. data/test/integration/tests/basic_computer_games/superstartrek.bas +425 -0
  378. data/test/integration/tests/basic_computer_games/superstartrek.input +21 -0
  379. data/test/integration/tests/basic_computer_games/superstartrek.output +151 -0
  380. data/test/integration/tests/basic_computer_games/superstartrekins.bas +127 -0
  381. data/test/integration/tests/basic_computer_games/superstartrekins.input +1 -0
  382. data/test/integration/tests/basic_computer_games/superstartrekins.output +134 -0
  383. data/test/integration/tests/basic_computer_games/synonym.bas +53 -0
  384. data/test/integration/tests/basic_computer_games/synonym.input +13 -0
  385. data/test/integration/tests/basic_computer_games/synonym.output +57 -0
  386. data/test/integration/tests/basic_computer_games/target.bas +51 -0
  387. data/test/integration/tests/basic_computer_games/target.input +2 -0
  388. data/test/integration/tests/basic_computer_games/target.output +39 -0
  389. data/test/integration/tests/basic_computer_games/tictac1.bas +69 -0
  390. data/test/integration/tests/basic_computer_games/tictac1.input +10 -0
  391. data/test/integration/tests/basic_computer_games/tictac1.output +49 -0
  392. data/test/integration/tests/basic_computer_games/tictac2.bas +114 -0
  393. data/test/integration/tests/basic_computer_games/tictac2.input +6 -0
  394. data/test/integration/tests/basic_computer_games/tictac2.output +104 -0
  395. data/test/integration/tests/basic_computer_games/towers.bas +125 -0
  396. data/test/integration/tests/basic_computer_games/towers.input +9 -0
  397. data/test/integration/tests/basic_computer_games/towers.output +70 -0
  398. data/test/integration/tests/basic_computer_games/train.bas +24 -0
  399. data/test/integration/tests/basic_computer_games/train.input +4 -0
  400. data/test/integration/tests/basic_computer_games/train.output +23 -0
  401. data/test/integration/tests/basic_computer_games/trap.bas +49 -0
  402. data/test/integration/tests/basic_computer_games/trap.input +7 -0
  403. data/test/integration/tests/basic_computer_games/trap.output +40 -0
  404. data/test/integration/tests/basic_computer_games/war.bas +68 -0
  405. data/test/integration/tests/basic_computer_games/war.input +11 -0
  406. data/test/integration/tests/basic_computer_games/war.output +54 -0
  407. data/test/integration/tests/basic_computer_games/weekday.bas +150 -0
  408. data/test/integration/tests/basic_computer_games/weekday.input +2 -0
  409. data/test/integration/tests/basic_computer_games/weekday.output +28 -0
  410. data/test/integration/tests/basic_computer_games/word.bas +65 -0
  411. data/test/integration/tests/basic_computer_games/word.input +6 -0
  412. data/test/integration/tests/basic_computer_games/word.output +0 -0
  413. data/test/integration/tests/fast/abs.bas +5 -0
  414. data/test/integration/tests/fast/abs.input +0 -0
  415. data/test/integration/tests/fast/abs.output +5 -0
  416. data/test/integration/tests/fast/add.bas +5 -0
  417. data/test/integration/tests/fast/add.input +0 -0
  418. data/test/integration/tests/fast/add.output +5 -0
  419. data/test/integration/tests/fast/and.bas +5 -0
  420. data/test/integration/tests/fast/and.input +0 -0
  421. data/test/integration/tests/fast/and.output +5 -0
  422. data/test/integration/tests/fast/array.bas +11 -0
  423. data/test/integration/tests/fast/array.input +0 -0
  424. data/test/integration/tests/fast/array.output +6 -0
  425. data/test/integration/tests/fast/asc.bas +1 -0
  426. data/test/integration/tests/fast/asc.input +0 -0
  427. data/test/integration/tests/fast/asc.output +1 -0
  428. data/test/integration/tests/fast/chr.bas +1 -0
  429. data/test/integration/tests/fast/chr.input +0 -0
  430. data/test/integration/tests/fast/chr.output +1 -0
  431. data/test/integration/tests/fast/cos.bas +1 -0
  432. data/test/integration/tests/fast/cos.input +0 -0
  433. data/test/integration/tests/fast/cos.output +1 -0
  434. data/test/integration/tests/fast/def_fn.bas +9 -0
  435. data/test/integration/tests/fast/def_fn.input +0 -0
  436. data/test/integration/tests/fast/def_fn.output +5 -0
  437. data/test/integration/tests/fast/divide.bas +5 -0
  438. data/test/integration/tests/fast/divide.input +0 -0
  439. data/test/integration/tests/fast/divide.output +5 -0
  440. data/test/integration/tests/fast/end.bas +3 -0
  441. data/test/integration/tests/fast/end.input +0 -0
  442. data/test/integration/tests/fast/end.output +1 -0
  443. data/test/integration/tests/fast/eq.bas +3 -0
  444. data/test/integration/tests/fast/eq.input +0 -0
  445. data/test/integration/tests/fast/eq.output +3 -0
  446. data/test/integration/tests/fast/exp.bas +2 -0
  447. data/test/integration/tests/fast/exp.input +0 -0
  448. data/test/integration/tests/fast/exp.output +2 -0
  449. data/test/integration/tests/fast/float.bas +3 -0
  450. data/test/integration/tests/fast/float.input +0 -0
  451. data/test/integration/tests/fast/float.output +2 -0
  452. data/test/integration/tests/fast/for_next.bas +61 -0
  453. data/test/integration/tests/fast/for_next.input +0 -0
  454. data/test/integration/tests/fast/for_next.output +46 -0
  455. data/test/integration/tests/fast/ge.bas +3 -0
  456. data/test/integration/tests/fast/ge.input +0 -0
  457. data/test/integration/tests/fast/ge.output +3 -0
  458. data/test/integration/tests/fast/gosub_return.bas +10 -0
  459. data/test/integration/tests/fast/gosub_return.input +0 -0
  460. data/test/integration/tests/fast/gosub_return.output +4 -0
  461. data/test/integration/tests/fast/goto.bas +3 -0
  462. data/test/integration/tests/fast/goto.input +0 -0
  463. data/test/integration/tests/fast/goto.output +1 -0
  464. data/test/integration/tests/fast/gt.bas +3 -0
  465. data/test/integration/tests/fast/gt.input +0 -0
  466. data/test/integration/tests/fast/gt.output +3 -0
  467. data/test/integration/tests/fast/if.bas +25 -0
  468. data/test/integration/tests/fast/if.input +0 -0
  469. data/test/integration/tests/fast/if.output +8 -0
  470. data/test/integration/tests/fast/input.bas +24 -0
  471. data/test/integration/tests/fast/input.input +10 -0
  472. data/test/integration/tests/fast/input.output +28 -0
  473. data/test/integration/tests/fast/int.bas +5 -0
  474. data/test/integration/tests/fast/int.input +0 -0
  475. data/test/integration/tests/fast/int.output +5 -0
  476. data/test/integration/tests/fast/integer_plus_string.bas +1 -0
  477. data/test/integration/tests/fast/integer_plus_string.input +0 -0
  478. data/test/integration/tests/fast/integer_plus_string.output +1 -0
  479. data/test/integration/tests/fast/invalid_argument.bas +1 -0
  480. data/test/integration/tests/fast/invalid_argument.input +0 -0
  481. data/test/integration/tests/fast/invalid_argument.output +1 -0
  482. data/test/integration/tests/fast/le.bas +3 -0
  483. data/test/integration/tests/fast/le.input +0 -0
  484. data/test/integration/tests/fast/le.output +3 -0
  485. data/test/integration/tests/fast/left.bas +1 -0
  486. data/test/integration/tests/fast/left.input +0 -0
  487. data/test/integration/tests/fast/left.output +1 -0
  488. data/test/integration/tests/fast/len.bas +2 -0
  489. data/test/integration/tests/fast/len.input +0 -0
  490. data/test/integration/tests/fast/len.output +2 -0
  491. data/test/integration/tests/fast/let.bas +6 -0
  492. data/test/integration/tests/fast/let.input +0 -0
  493. data/test/integration/tests/fast/let.output +4 -0
  494. data/test/integration/tests/fast/log.bas +1 -0
  495. data/test/integration/tests/fast/log.input +0 -0
  496. data/test/integration/tests/fast/log.output +1 -0
  497. data/test/integration/tests/fast/lt.bas +3 -0
  498. data/test/integration/tests/fast/lt.input +0 -0
  499. data/test/integration/tests/fast/lt.output +3 -0
  500. data/test/integration/tests/fast/math.output +0 -0
  501. data/test/integration/tests/fast/mid.bas +2 -0
  502. data/test/integration/tests/fast/mid.input +0 -0
  503. data/test/integration/tests/fast/mid.output +2 -0
  504. data/test/integration/tests/fast/multiply.bas +5 -0
  505. data/test/integration/tests/fast/multiply.input +0 -0
  506. data/test/integration/tests/fast/multiply.output +5 -0
  507. data/test/integration/tests/fast/ne.bas +3 -0
  508. data/test/integration/tests/fast/ne.input +0 -0
  509. data/test/integration/tests/fast/ne.output +3 -0
  510. data/test/integration/tests/fast/negate.bas +4 -0
  511. data/test/integration/tests/fast/negate.input +0 -0
  512. data/test/integration/tests/fast/negate.output +3 -0
  513. data/test/integration/tests/fast/not.bas +4 -0
  514. data/test/integration/tests/fast/not.input +0 -0
  515. data/test/integration/tests/fast/not.output +4 -0
  516. data/test/integration/tests/fast/on_goto.bas +6 -0
  517. data/test/integration/tests/fast/on_goto.input +0 -0
  518. data/test/integration/tests/fast/on_goto.output +2 -0
  519. data/test/integration/tests/fast/or.bas +5 -0
  520. data/test/integration/tests/fast/or.input +0 -0
  521. data/test/integration/tests/fast/or.output +5 -0
  522. data/test/integration/tests/fast/parentheses.bas +1 -0
  523. data/test/integration/tests/fast/parentheses.input +0 -0
  524. data/test/integration/tests/fast/parentheses.output +1 -0
  525. data/test/integration/tests/fast/power.bas +4 -0
  526. data/test/integration/tests/fast/power.input +0 -0
  527. data/test/integration/tests/fast/power.output +4 -0
  528. data/test/integration/tests/fast/print.bas +6 -0
  529. data/test/integration/tests/fast/print.input +0 -0
  530. data/test/integration/tests/fast/print.output +4 -0
  531. data/test/integration/tests/fast/read_data.bas +15 -0
  532. data/test/integration/tests/fast/read_data.input +0 -0
  533. data/test/integration/tests/fast/read_data.output +4 -0
  534. data/test/integration/tests/fast/rem.bas +1 -0
  535. data/test/integration/tests/fast/rem.input +0 -0
  536. data/test/integration/tests/fast/rem.output +0 -0
  537. data/test/integration/tests/fast/right.bas +1 -0
  538. data/test/integration/tests/fast/right.input +0 -0
  539. data/test/integration/tests/fast/right.output +1 -0
  540. data/test/integration/tests/fast/rnd.bas +5 -0
  541. data/test/integration/tests/fast/rnd.input +0 -0
  542. data/test/integration/tests/fast/rnd.output +5 -0
  543. data/test/integration/tests/fast/sgn.bas +5 -0
  544. data/test/integration/tests/fast/sgn.input +0 -0
  545. data/test/integration/tests/fast/sgn.output +5 -0
  546. data/test/integration/tests/fast/sin.bas +1 -0
  547. data/test/integration/tests/fast/sin.input +0 -0
  548. data/test/integration/tests/fast/sin.output +1 -0
  549. data/test/integration/tests/fast/sqr.bas +2 -0
  550. data/test/integration/tests/fast/sqr.input +0 -0
  551. data/test/integration/tests/fast/sqr.output +2 -0
  552. data/test/integration/tests/fast/stop.bas +3 -0
  553. data/test/integration/tests/fast/stop.input +0 -0
  554. data/test/integration/tests/fast/stop.output +2 -0
  555. data/test/integration/tests/fast/str.bas +3 -0
  556. data/test/integration/tests/fast/str.input +0 -0
  557. data/test/integration/tests/fast/str.output +3 -0
  558. data/test/integration/tests/fast/string_addition.bas +1 -0
  559. data/test/integration/tests/fast/string_addition.input +0 -0
  560. data/test/integration/tests/fast/string_addition.output +1 -0
  561. data/test/integration/tests/fast/string_comparisons.bas +7 -0
  562. data/test/integration/tests/fast/string_comparisons.input +0 -0
  563. data/test/integration/tests/fast/string_comparisons.output +4 -0
  564. data/test/integration/tests/fast/string_plus_integer.bas +1 -0
  565. data/test/integration/tests/fast/string_plus_integer.input +0 -0
  566. data/test/integration/tests/fast/string_plus_integer.output +1 -0
  567. data/test/integration/tests/fast/subtract.bas +5 -0
  568. data/test/integration/tests/fast/subtract.input +0 -0
  569. data/test/integration/tests/fast/subtract.output +5 -0
  570. data/test/integration/tests/fast/tab.bas +4 -0
  571. data/test/integration/tests/fast/tab.input +0 -0
  572. data/test/integration/tests/fast/tab.output +3 -0
  573. data/test/integration/tests/fast/tan.bas +1 -0
  574. data/test/integration/tests/fast/tan.input +0 -0
  575. data/test/integration/tests/fast/tan.output +1 -0
  576. data/test/integration/tests/fast/val.bas +3 -0
  577. data/test/integration/tests/fast/val.input +0 -0
  578. data/test/integration/tests/fast/val.output +3 -0
  579. data/test/spec/argument_checker_spec.rb +128 -0
  580. data/test/spec/basic_array_spec.rb +100 -0
  581. data/test/spec/basic_float_spec.rb +168 -0
  582. data/test/spec/basic_integer_spec.rb +270 -0
  583. data/test/spec/basic_numeric_spec.rb +16 -0
  584. data/test/spec/basic_object_spec.rb +22 -0
  585. data/test/spec/basic_string_spec.rb +259 -0
  586. data/test/spec/for_stack_spec.rb +70 -0
  587. data/test/spec/input_reader_spec.rb +143 -0
  588. data/test/spec/input_spec.rb +102 -0
  589. data/test/spec/line_spec.rb +18 -0
  590. data/test/spec/output_spec.rb +153 -0
  591. data/test/spec/parser_spec.rb +562 -0
  592. data/test/spec/program_spec.rb +45 -0
  593. data/test/spec/spec_helper.rb +15 -0
  594. data/test/spec/support/basic_numeric_helpers.rb +327 -0
  595. data/test/spec/support/basic_object_helpers.rb +22 -0
  596. data/test/spec/transcript_spec.rb +37 -0
  597. data/test/spec/transform_spec.rb +513 -0
  598. metadata +742 -0
@@ -0,0 +1,196 @@
1
+ 5 PRINT TAB(33);"BATTLE"
2
+ 7 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
3
+ 10 REM -- BATTLE WRITTEN BY RAY WESTERGARD 10/70
4
+ 20 REM COPYRIGHT 1971 BY THE REGENTS OF THE UNIV. OF CALIF.
5
+ 30 REM PRODUCED AT THE LAWRENCE HALL OF SCIENCE, BERKELEY
6
+ 40 REM DIM F(6,6),H(6,6),A(4)<B(4),C(6),L(3)
7
+ 50 FOR X=1 TO 6
8
+ 51 FOR Y=1 TO 6
9
+ 52 F(X,Y)=0
10
+ 53 NEXT Y
11
+ 54 NEXT X
12
+ 60 FOR I=1 TO 3
13
+ 70 N=4-I
14
+ 80 FOR J=1 TO 2
15
+ 90 A=INT(6*RND(1)+1)
16
+ 100 B=INT(6*RND(1)+1)
17
+ 110 D=INT(4*RND(1)+1)
18
+ 120 IF F(A,B)>0 THEN 90
19
+ 130 M=0
20
+ 140 ON D GOTO 150,340,550,740
21
+ 150 B(1)=B
22
+ 160 B(2)=7:B(3)=7
23
+ 170 FOR K=1 TO N
24
+ 180 IF M>1 THEN 240
25
+ 190 IF B(K)=6 THEN 230
26
+ 200 IF F(A,B(K)+1)>0 THEN 230
27
+ 210 B(K+1)=B(K)+1
28
+ 220 GOTO 280
29
+ 230 M=2
30
+ 240 IF B(1)<B(2) AND B(1)<B(3) THEN Z=B(1)
31
+ 242 IF B(2)<B(1) AND B(2)<B(3) THEN Z=B(2)
32
+ 244 IF B(3)<B(1) AND B(3)<B(2) THEN Z=B(3)
33
+ 250 IF Z=1 THEN 90
34
+ 260 IF F(A,Z-1)>0 THEN 90
35
+ 270 B(K+1)=Z-1
36
+ 280 NEXT K
37
+ 290 F(A,B)=9-2*I-J
38
+ 300 FOR K=1 TO N
39
+ 310 F(A,B(K+1))=F(A,B)
40
+ 320 NEXT K
41
+ 330 GOTO 990
42
+ 340 A(1)=A
43
+ 350 B(1)=B
44
+ 360 A(2)=0:A(3)=0:B(2)=0:B(3)=0
45
+ 370 FOR K=1 TO N
46
+ 380 IF M>1 THEN 460
47
+ 390 IF A(K)=1 OR B(K)=1 THEN 450
48
+ 400 IF F(A(K)-1,B(K)-1)>0 THEN 450
49
+ 410 IF F(A(K)-1,B(K))>0 AND F(A(K)-1,B(K))=F(A(K),B(K)-1) THEN 450
50
+ 420 A(K+1)=A(K)-1
51
+ 430 B(K+1)=B(K)-1
52
+ 440 GOTO 530
53
+ 450 M=2
54
+ 460 IF A(1)>A(2) AND A(1)>A(3) THEN Z1=A(1)
55
+ 462 IF A(2)>A(1) AND A(2)>A(3) THEN Z1=A(2)
56
+ 464 IF A(3)>A(1) AND A(3)>A(2) THEN Z1=A(3)
57
+ 470 IF B(1)>B(2) AND B(1)>B(3) THEN Z2=B(1)
58
+ 474 IF B(2)>B(1) AND B(2)>B(3) THEN Z2=B(2)
59
+ 476 IF B(3)>B(1) AND B(3)>B(2) THEN Z2=B(3)
60
+ 480 IF Z1=6 OR Z2=6 THEN 90
61
+ 490 IF F(Z1+1,Z2+1)>0 THEN 90
62
+ 500 IF F(Z1,Z2+1)>0 AND F(Z1,Z2+1)=F(Z1+1,Z2) THEN 90
63
+ 510 A(K+1)=Z1+1
64
+ 520 B(K+1)=Z2+1
65
+ 530 NEXT K
66
+ 540 GOTO 950
67
+ 550 A(1)=A
68
+ 560 A(2)=7:A(3)=7
69
+ 570 FOR K=1 TO N
70
+ 580 IF M>1 THEN 640
71
+ 590 IF A(K)=6 THEN 630
72
+ 600 IF F(A(K)+1,B)>0 THEN 630
73
+ 610 A(K+1)=A(K)+1
74
+ 620 GOTO 680
75
+ 630 M=2
76
+ 640 IF A(1)<A(2) AND A(1)<A(3) THEN Z=A(1)
77
+ 642 IF A(2)<A(1) AND A(2)<A(3) THEN Z=A(2)
78
+ 644 IF A(3)<A(1) AND A(3)<A(2) THEN Z=A(3)
79
+ 650 IF Z=1 THEN 90
80
+ 660 IF F(Z-1,B)>0 THEN 90
81
+ 670 A(K+1)=Z-1
82
+ 680 NEXT K
83
+ 690 F(A,B)=9-2*I-J
84
+ 700 FOR K=1 TO N
85
+ 710 F(A(K+1),B)=F(A,B)
86
+ 720 NEXT K
87
+ 730 GOTO 990
88
+ 740 A(1)=A
89
+ 750 B(1)=B
90
+ 760 A(2)=7:A(3)=7
91
+ 770 B(2)=0:B(3)=0
92
+ 780 FOR K=1 TO N
93
+ 790 IF M>1 THEN 870
94
+ 800 IF A(K)=6 OR B(K)=1 THEN 860
95
+ 810 IF F(A(K)+1,B(K)-1)>0 THEN 860
96
+ 820 IF F(A(K)+1,B(K))>0 AND F(A(K)+1,B(K))=F(A(K),B(K)-1) THEN 860
97
+ 830 A(K+1)=A(K)+1
98
+ 840 B(K+1)=B(K)-1
99
+ 850 GOTO 940
100
+ 860 M=2
101
+ 870 IF A(1)<A(2) AND A(1)<A(3) THEN Z1=A(1)
102
+ 872 IF A(2)<A(1) AND A(2)<A(3) THEN Z1=A(2)
103
+ 874 IF A(3)<A(1) AND A(3)<A(2) THEN Z1=A(3)
104
+ 880 IF B(1)>B(2) AND B(1)>B(3) THEN Z2=B(1)
105
+ 882 IF B(2)>B(1) AND B(2)>B(3) THEN Z2=B(2)
106
+ 884 IF B(3)>B(1) AND B(3)>B(2) THEN Z2=B(3)
107
+ 890 IF Z1=1 OR Z2=6 THEN 90
108
+ 900 IF F(Z1-1,Z2+1)>0 THEN 90
109
+ 910 IF F(Z1,Z2+1)>0 AND F(Z1,Z2+1)=F(Z1-1,Z2) THEN 90
110
+ 920 A(K+1)=Z1-1
111
+ 930 B(K+1)=Z2+1
112
+ 940 NEXT K
113
+ 950 F(A,B)=9-2*I-J
114
+ 960 FOR K=1 TO N
115
+ 970 F(A(K+1),B(K+1))=F(A,B)
116
+ 980 NEXT K
117
+ 990 NEXT J
118
+ 1000 NEXT I
119
+ 1010 PRINT
120
+ 1020 PRINT "THE FOLLOWING CODE OF THE BAD GUYS' FLEET DISPOSITION"
121
+ 1030 PRINT "HAS BEEN CAPTURED BUT NOT DECODED:"
122
+ 1040 PRINT
123
+ 1050 FOR I=1 TO 6
124
+ 1051 FOR J=1 TO 6
125
+ 1052 H(I,J)=F(J,I)
126
+ 1053 NEXT J
127
+ 1054 NEXT I
128
+ 1060 FOR I=1 TO 6
129
+ 1061 FOR J=1 TO 6
130
+ 1062 PRINT H(I,J);
131
+ 1063 NEXT J
132
+ 1064 PRINT
133
+ 1065 NEXT I
134
+ 1070 PRINT
135
+ 1080 PRINT "DE-CODE IT AND USE IT IF YOU CAN"
136
+ 1090 PRINT "BUT KEEP THE DE-CODING METHOD A SECRET."
137
+ 1100 PRINT
138
+ 1110 FOR I=1 TO 6
139
+ 1111 FOR J=1 TO 6
140
+ 1112 H(I,J)=0
141
+ 1113 NEXT J
142
+ 1114 NEXT I
143
+ 1120 FOR I=1 TO 3
144
+ 1121 L(I)=0
145
+ 1122 NEXT I
146
+ 1130 C(1)=2:C(2)=2
147
+ 1140 C(3)=1:C(4)=1
148
+ 1150 C(5)=0:C(6)=0
149
+ 1160 S=0:H=0
150
+ 1170 PRINT "START GAME"
151
+ 1180 INPUT X,Y
152
+ 1190 IF X<1 OR X>6 OR INT(X)<>ABS(X) THEN 1210
153
+ 1200 IF Y>0 AND Y<7 AND INT(Y)=ABS(Y) THEN 1230
154
+ 1210 PRINT "INVALID INPUT. TRY AGAIN."
155
+ 1220 GOTO 1180
156
+ 1230 R=7-Y
157
+ 1240 C=X
158
+ 1250 IF F(R,C)>0 THEN 1290
159
+ 1260 S=S+1
160
+ 1270 PRINT "SPLASH! TRY AGAIN."
161
+ 1280 GOTO 1180
162
+ 1290 IF C(F(R,C))<4 THEN 1340
163
+ 1300 PRINT "THERE USED TO BE A SHIP AT THAT POINT, BUT YOU SUNK IT."
164
+ 1310 PRINT "SPLASH! TRY AGAIN."
165
+ 1320 S=S+1
166
+ 1330 GOTO 1180
167
+ 1340 IF H(R,C)>0 THEN 1420
168
+ 1350 H=H+1
169
+ 1360 H(R,C)=F(R,C)
170
+ 1370 PRINT "A DIRECT HIT ON SHIP NUMBER";F(R,C)
171
+ 1380 C(F(R,C))=C(F(R,C))+1
172
+ 1390 IF C(F(R,C))>=4 THEN 1470
173
+ 1400 PRINT "TRY AGAIN."
174
+ 1410 GOTO 1180
175
+ 1420 PRINT "YOU ALREADY PUT A HOLE IN SHIP NUMBER";F(R,C);
176
+ 1430 PRINT "AT THAT POINT."
177
+ 1440 PRINT "SPLASH! TRY AGAIN."
178
+ 1450 S=S+1
179
+ 1460 GOTO 1180
180
+ 1470 L((INT(F(R,C)-1)/2)+1)=L((INT(F(R,C)-1)/2)+1)+1
181
+ 1480 PRINT "AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS."
182
+ 1490 PRINT "SO FAR, THE BAD GUYS HAVE LOST"
183
+ 1500 PRINT L(1);"DESTROYER(S),";L(2);"CRUISER(S), AND";
184
+ 1510 PRINT L(3);"AIRCRAFT CARRIER(S)."
185
+ 1520 PRINT "YOUR CURRENT SPLASH/HIT RATIO IS";S/H
186
+ 1530 IF (L(1)+L(2)+L(3))<6 THEN 1180
187
+ 1540 PRINT
188
+ 1550 PRINT "YOU HAVE TOTALLY WIPED OUT THE BAD GUYS' FLEET"
189
+ 1560 PRINT "WITH A FINAL SPLASH/HIT RATIO OF";S/H
190
+ 1570 IF S/H>0 THEN 1590
191
+ 1580 PRINT "CONGRATULATIONS -- A DIRECT HIT EVERY TIME."
192
+ 1590 PRINT
193
+ 1600 PRINT "****************************"
194
+ 1610 PRINT
195
+ 1620 GOTO 50
196
+ 1630 END
@@ -0,0 +1,21 @@
1
+
2
+ YES
3
+ 1,1
4
+ 1,2
5
+ 1,3
6
+ 1,4
7
+ 1,5
8
+ 3,1
9
+ 3,2
10
+ 3,3
11
+ 3,4
12
+ 3,5
13
+ 3,6
14
+ 4,6
15
+ 5,6
16
+ 6,6
17
+ 6,1
18
+ 5,1
19
+ 5,2
20
+ 5,3
21
+ 5,4
@@ -0,0 +1,118 @@
1
+ BATTLE
2
+ CREATIVE COMPUTING MORRISTOWN, NEW JERSEY
3
+
4
+ THE FOLLOWING CODE OF THE BAD GUYS' FLEET DISPOSITION
5
+ HAS BEEN CAPTURED BUT NOT DECODED:
6
+
7
+ 0 1 1 3 3 3
8
+ 0 0 0 0 0 0
9
+ 2 2 5 5 5 5
10
+ 4 0 0 0 0 0
11
+ 4 0 6 6 6 6
12
+ 4 0 0 0 0 0
13
+
14
+ DE-CODE IT AND USE IT IF YOU CAN
15
+ BUT KEEP THE DE-CODING METHOD A SECRET.
16
+
17
+ START GAME
18
+ ?
19
+ Too few items, try again
20
+ ? YES
21
+ Not numeric: "YES", try again
22
+ ? 1,1
23
+ A DIRECT HIT ON SHIP NUMBER 3
24
+ TRY AGAIN.
25
+ ? 1,2
26
+ A DIRECT HIT ON SHIP NUMBER 3
27
+ TRY AGAIN.
28
+ ? 1,3
29
+ A DIRECT HIT ON SHIP NUMBER 3
30
+ AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS.
31
+ SO FAR, THE BAD GUYS HAVE LOST
32
+ 0 DESTROYER(S), 1 CRUISER(S), AND 0 AIRCRAFT CARRIER(S).
33
+ YOUR CURRENT SPLASH/HIT RATIO IS 0
34
+ ? 1,4
35
+ A DIRECT HIT ON SHIP NUMBER 1
36
+ TRY AGAIN.
37
+ ? 1,5
38
+ A DIRECT HIT ON SHIP NUMBER 1
39
+ AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS.
40
+ SO FAR, THE BAD GUYS HAVE LOST
41
+ 1 DESTROYER(S), 1 CRUISER(S), AND 0 AIRCRAFT CARRIER(S).
42
+ YOUR CURRENT SPLASH/HIT RATIO IS 0
43
+ ? 3,1
44
+ A DIRECT HIT ON SHIP NUMBER 5
45
+ TRY AGAIN.
46
+ ? 3,2
47
+ A DIRECT HIT ON SHIP NUMBER 5
48
+ TRY AGAIN.
49
+ ? 3,3
50
+ A DIRECT HIT ON SHIP NUMBER 5
51
+ TRY AGAIN.
52
+ ? 3,4
53
+ A DIRECT HIT ON SHIP NUMBER 5
54
+ AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS.
55
+ SO FAR, THE BAD GUYS HAVE LOST
56
+ 1 DESTROYER(S), 1 CRUISER(S), AND 1 AIRCRAFT CARRIER(S).
57
+ YOUR CURRENT SPLASH/HIT RATIO IS 0
58
+ ? 3,5
59
+ A DIRECT HIT ON SHIP NUMBER 2
60
+ TRY AGAIN.
61
+ ? 3,6
62
+ A DIRECT HIT ON SHIP NUMBER 2
63
+ AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS.
64
+ SO FAR, THE BAD GUYS HAVE LOST
65
+ 2 DESTROYER(S), 1 CRUISER(S), AND 1 AIRCRAFT CARRIER(S).
66
+ YOUR CURRENT SPLASH/HIT RATIO IS 0
67
+ ? 4,6
68
+ A DIRECT HIT ON SHIP NUMBER 4
69
+ TRY AGAIN.
70
+ ? 5,6
71
+ A DIRECT HIT ON SHIP NUMBER 4
72
+ TRY AGAIN.
73
+ ? 6,6
74
+ A DIRECT HIT ON SHIP NUMBER 4
75
+ AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS.
76
+ SO FAR, THE BAD GUYS HAVE LOST
77
+ 2 DESTROYER(S), 2 CRUISER(S), AND 1 AIRCRAFT CARRIER(S).
78
+ YOUR CURRENT SPLASH/HIT RATIO IS 0
79
+ ? 6,1
80
+ SPLASH! TRY AGAIN.
81
+ ? 5,1
82
+ A DIRECT HIT ON SHIP NUMBER 6
83
+ TRY AGAIN.
84
+ ? 5,2
85
+ A DIRECT HIT ON SHIP NUMBER 6
86
+ TRY AGAIN.
87
+ ? 5,3
88
+ A DIRECT HIT ON SHIP NUMBER 6
89
+ TRY AGAIN.
90
+ ? 5,4
91
+ A DIRECT HIT ON SHIP NUMBER 6
92
+ AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS.
93
+ SO FAR, THE BAD GUYS HAVE LOST
94
+ 2 DESTROYER(S), 2 CRUISER(S), AND 2 AIRCRAFT CARRIER(S).
95
+ YOUR CURRENT SPLASH/HIT RATIO IS 0.05555556
96
+
97
+ YOU HAVE TOTALLY WIPED OUT THE BAD GUYS' FLEET
98
+ WITH A FINAL SPLASH/HIT RATIO OF 0.05555556
99
+
100
+ ****************************
101
+
102
+
103
+ THE FOLLOWING CODE OF THE BAD GUYS' FLEET DISPOSITION
104
+ HAS BEEN CAPTURED BUT NOT DECODED:
105
+
106
+ 5 5 5 5 4 0
107
+ 2 0 0 4 1 0
108
+ 2 6 4 0 1 0
109
+ 0 6 0 3 3 3
110
+ 0 6 0 0 0 0
111
+ 0 6 0 0 0 0
112
+
113
+ DE-CODE IT AND USE IT IF YOU CAN
114
+ BUT KEEP THE DE-CODING METHOD A SECRET.
115
+
116
+ START GAME
117
+ ?
118
+ Error on line 1180: No more input
@@ -0,0 +1,321 @@
1
+ 2 PRINT TAB(31);"BLACK JACK"
2
+ 4 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
3
+ 6 PRINT:PRINT:PRINT
4
+ 10 DEF FNA(Q)=Q+11*(Q>=22)
5
+ 20 DIM P(15,12),Q(15),C(52),D(52),T(8),S(7),B(15)
6
+ 30 DIM R(15)
7
+ 40 REM--P(I,J) IS THE JTH CARD IN HAND I, Q(I) IS TOTAL OF HAND I
8
+ 50 REM--C IS THE DECK BEING DEALT FROM, D IS THE DISCARD PILE,
9
+ 60 REM--T(I) IS THE TOTAL FOR PLAYER I, S(I) IS THE TOTAL THIS HAND FOR
10
+ 70 REM--PLAYER I, B(I) IS TH BET FOR HAND I
11
+ 80 REM--R(I) IS THE LENGTH OF P(I,*)
12
+ 90 GOTO 1500
13
+ 100 REM--SUBROUTINE TO GET A CARD. RESULT IS PUT IN X.
14
+ 110 IF C<51 THEN 230
15
+ 120 PRINT "RESHUFFLING"
16
+ 130 FOR D=D TO 1 STEP -1
17
+ 140 C=C-1
18
+ 150 C(C)=D(D)
19
+ 160 NEXT D
20
+ 170 FOR C1=52 TO C STEP -1
21
+ 180 C2=INT(RND(1)*(C1-C+1))+C
22
+ 190 C3=C(C2)
23
+ 200 C(C2)=C(C1)
24
+ 210 C(C1)=C3
25
+ 220 NEXT C1
26
+ 230 X=C(C)
27
+ 240 C=C+1
28
+ 250 RETURN
29
+ 300 REM--SUBROUTINE TO EVALUATE HAND I. TOTAL IS PUT INTO
30
+ 310 REM--Q(I). TOTALS HAVE THE FOLLOWING MEANING:
31
+ 320 REM-- 2-10...HARD 2-10
32
+ 330 REM-- 11-21...SOFT 11-21
33
+ 340 REM-- 22-32...HARD 11-21
34
+ 350 REM-- 33+....BUSTED
35
+ 360 Q=0
36
+ 370 FOR Q2=1 TO R(I)
37
+ 380 X=P(I,Q2)
38
+ 390 GOSUB 500
39
+ 400 NEXT Q2
40
+ 410 Q(I)=Q
41
+ 420 RETURN
42
+ 500 REM--SUBROUTINE TO ADD CARD X TO TOTAL Q.
43
+ 510 X1=X: IF X1>10 THEN X1=10: REM SAME AS X1=10 MIN X
44
+ 520 Q1=Q+X1
45
+ 530 IF Q>=11 THEN 590
46
+ 540 IF X>1 THEN 570
47
+ 550 Q=Q+11
48
+ 560 RETURN
49
+ 570 Q=Q1-11*(Q1>=11)
50
+ 580 RETURN
51
+ 590 Q=Q1-(Q<=21 AND Q1>21)
52
+ 600 IF Q<33 THEN 620
53
+ 610 Q=-1
54
+ 620 RETURN
55
+ 700 REM--CARD PRINTING SUBROUTINE
56
+ 710 REM D$ DEFINED ELSEWHERE
57
+ 720 PRINT MID$(D$,3*X-2,3);
58
+ 730 PRINT " ";
59
+ 740 RETURN
60
+ 750 REM--ALTERNATIVE PRINTING ROUTINE
61
+ 760 PRINT " ";MID$(D$,3*X-1,2);
62
+ 770 PRINT " ";
63
+ 780 RETURN
64
+ 800 REM--SUBROUTINE TO PLAY OUT A HAND.
65
+ 810 REM--NO SPLITTING OR BLACKJACKS ALLOWED
66
+ 820 H1=5
67
+ 830 GOSUB 1410
68
+ 840 H1=3
69
+ 850 ON H GOTO 950,930
70
+ 860 GOSUB 100
71
+ 870 B(I)=B(I)*2
72
+ 880 PRINT "RECEIVED A";
73
+ 890 GOSUB 700
74
+ 900 GOSUB 1100
75
+ 910 IF Q>0 THEN GOSUB 1300
76
+ 920 RETURN
77
+ 930 GOSUB 1320
78
+ 940 RETURN
79
+ 950 GOSUB 100
80
+ 960 PRINT "RECEIVED A";
81
+ 970 GOSUB 700
82
+ 980 GOSUB 1100
83
+ 990 IF Q<0 THEN 940
84
+ 1000 PRINT "HIT";
85
+ 1010 GOTO 830
86
+ 1100 REM--SUBROUTINE TO ADD A CARD TO ROW I
87
+ 1110 R(I)=R(I)+1
88
+ 1120 P(I,R(I))=X
89
+ 1130 Q=Q(I)
90
+ 1140 GOSUB 500
91
+ 1150 Q(I)=Q
92
+ 1160 IF Q>=0 THEN 1190
93
+ 1170 PRINT "...BUSTED"
94
+ 1180 GOSUB 1200
95
+ 1190 RETURN
96
+ 1200 REM--SUBROUTINE TO DISCARD ROW I
97
+ 1210 IF R(I)<>0 THEN 1230
98
+ 1220 RETURN
99
+ 1230 D=D+1
100
+ 1240 D(D)=P(I,R(I))
101
+ 1250 R(I)=R(I)-1
102
+ 1260 GOTO 1210
103
+ 1300 REM--PRINTS TOTAL OF HAND I
104
+ 1310 PRINT
105
+ 1320 AA=Q(I): GOSUB 3400
106
+ 1325 PRINT "TOTAL IS";AA
107
+ 1330 RETURN
108
+ 1400 REM--SUBROUTINE TO READ REPLY
109
+ 1410 REM I$ DEFINED ELSEWHERE
110
+ 1420 INPUT H$: H$=LEFT$(H$,1)
111
+ 1430 FOR H=1 TO H1 STEP 2
112
+ 1440 IF H$=MID$(I$,H,1) THEN 1480
113
+ 1450 NEXT H
114
+ 1460 PRINT "TYPE ";MID$(I$,1,H1-1);" OR ";MID$(I$,H1,2);" PLEASE";
115
+ 1470 GOTO 1420
116
+ 1480 H=(H+1)/2
117
+ 1490 RETURN
118
+ 1500 REM--PROGRAM STARTS HERE
119
+ 1510 REM--INITIALIZE
120
+ 1520 D$="N A 2 3 4 5 6 7N 8 9 10 J Q K"
121
+ 1530 I$="H,S,D,/,"
122
+ 1540 FOR I=1 TO 13
123
+ 1550 FOR J=4*I-3 TO 4*I
124
+ 1560 D(J)=I
125
+ 1570 NEXT J
126
+ 1580 NEXT I
127
+ 1590 D=52
128
+ 1600 C=53
129
+ 1610 PRINT "DO YOU WANT INSTRUCTIONS";
130
+ 1620 INPUT H$
131
+ 1630 IF LEFT$(H$,1)="N" OR LEFT$(H$,1)="n" THEN 1760
132
+ 1640 PRINT "THIS IS THE GAME OF 21. AS MANY AS 7 PLAYERS MAY PLAY THE"
133
+ 1650 PRINT "GAME. ON EACH DEAL, BETS WILL BE ASKED FOR, AND THE"
134
+ 1660 PRINT "PLAYERS' BETS SHOULD BE TYPED IN. THE CARDS WILL THEN BE"
135
+ 1670 PRINT "DEALT, AND EACH PLAYER IN TURN PLAYS HIS HAND. THE"
136
+ 1680 PRINT "FIRST RESPONSE SHOULD BE EITHER 'D', INDICATING THAT THE"
137
+ 1690 PRINT "PLAYER IS DOUBLING DOWN, 'S', INDICATING THAT HE IS"
138
+ 1700 PRINT "STANDING, 'H', INDICATING HE WANTS ANOTHER CARD, OR '/',"
139
+ 1710 PRINT "INDICATING THAT HE WANTS TO SPLIT HIS CARDS. AFTER THE"
140
+ 1720 PRINT "INITIAL RESPONSE, ALL FURTHER RESPONSES SHOULD BE 'S' OR"
141
+ 1730 PRINT "'H', UNLESS THE CARDS WERE SPLIT, IN WHICH CASE DOUBLING"
142
+ 1740 PRINT "DOWN IS AGAIN PERMITTED. IN ORDER TO COLLECT FOR"
143
+ 1750 PRINT "BLACKJACK, THE INITIAL RESPONSE SHOULD BE 'S'."
144
+ 1760 PRINT "NUMBER OF PLAYERS";
145
+ 1770 INPUT N
146
+ 1775 PRINT
147
+ 1780 IF N<1 OR N>7 OR N>INT(N) THEN 1760
148
+ 1790 FOR I=1 TO 8: T(I)=0: NEXT I
149
+ 1800 D1=N+1
150
+ 1810 IF 2*D1+C>=52 THEN GOSUB 120
151
+ 1820 IF C=2 THEN C=C-1
152
+ 1830 FOR I=1 TO N: Z(I)=0: NEXT I
153
+ 1840 FOR I=1 TO 15: B(I)=0: NEXT I
154
+ 1850 FOR I=1 TO 15: Q(I)=0: NEXT I
155
+ 1860 FOR I=1 TO 7: S(I)=0: NEXT I
156
+ 1870 FOR I=1 TO 15: R(I)=0: NEXT I
157
+ 1880 PRINT "BETS:"
158
+ 1890 FOR I=1 TO N: PRINT "#";I;: INPUT Z(I): NEXT I
159
+ 1900 FOR I=1 TO N
160
+ 1910 IF Z(I)<=0 OR Z(I)>500 THEN 1880
161
+ 1920 B(I)=Z(I)
162
+ 1930 NEXT I
163
+ 1940 PRINT "PLAYER";
164
+ 1950 FOR I=1 TO N
165
+ 1960 PRINT I;" ";
166
+ 1970 NEXT I
167
+ 1980 PRINT "DEALER"
168
+ 1990 FOR J=1 TO 2
169
+ 2000 PRINT TAB(5);
170
+ 2010 FOR I=1 TO D1
171
+ 2020 GOSUB 100
172
+ 2030 P(I,J)=X
173
+ 2040 IF J=1 OR I<=N THEN GOSUB 750
174
+ 2050 NEXT I
175
+ 2060 PRINT
176
+ 2070 NEXT J
177
+ 2080 FOR I=1 TO D1
178
+ 2090 R(I)=2
179
+ 2100 NEXT I
180
+ 2110 REM--TEST FOR INSURANCE
181
+ 2120 IF P(D1,1)>1 THEN 2240
182
+ 2130 PRINT "ANY INSURANCE";
183
+ 2140 INPUT H$
184
+ 2150 IF LEFT$(H$,1)<>"Y" THEN 2240
185
+ 2160 PRINT "INSURANCE BETS"
186
+ 2170 FOR I=1 TO N: PRINT "#";I;: INPUT Z(I): NEXT I
187
+ 2180 FOR I=1 TO N
188
+ 2190 IF Z(I)<0 OR Z(I)>B(I)/2 THEN 2160
189
+ 2200 NEXT I
190
+ 2210 FOR I=1 TO N
191
+ 2220 S(I)=Z(I)*(3*(-(P(D1,2)>=10))-1)
192
+ 2230 NEXT I
193
+ 2240 REM--TEST FOR DEALER BLACKJACK
194
+ 2250 L1=1: L2=1
195
+ 2252 IF P(D1,1)=1 AND P(D1,2)>9 THEN L1=0: L2=0
196
+ 2253 IF P(D1,2)=1 AND P(D1,1)>9 THEN L1=0: L2=0
197
+ 2254 IF L1<>0 OR L2<>0 THEN 2320
198
+ 2260 PRINT:PRINT "DEALER HAS A";MID$(D$,3*P(D1,2)-2,3);" IN THE HOLE ";
199
+ 2270 PRINT "FOR BLACKJACK"
200
+ 2280 FOR I=1 TO D1
201
+ 2290 GOSUB 300
202
+ 2300 NEXT I
203
+ 2310 GOTO 3140
204
+ 2320 REM--NO DEALER BLACKJACK
205
+ 2330 IF P(D1,1)>1 AND P(D1,1)<10 THEN 2350
206
+ 2340 PRINT:PRINT "NO DEALER BLACKJACK."
207
+ 2350 REM--NOW PLAY THE HANDS
208
+ 2360 FOR I=1 TO N
209
+ 2370 PRINT "PLAYER";I;
210
+ 2380 H1=7
211
+ 2390 GOSUB 1410
212
+ 2400 ON H GOTO 2550,2410,2510,2600
213
+ 2410 REM--PLAYER WANTS TO STAND
214
+ 2420 GOSUB 300
215
+ 2430 IF Q(I)<>21 THEN 2490
216
+ 2440 PRINT "BLACKJACK"
217
+ 2450 S(I)=S(I)+1.5*B(I)
218
+ 2460 B(I)=0
219
+ 2470 GOSUB 1200
220
+ 2480 GOTO 2900
221
+ 2490 GOSUB 1320
222
+ 2500 GOTO 2900
223
+ 2510 REM--PLAYER WANTS TO DOUBLE DOWN
224
+ 2520 GOSUB 300
225
+ 2530 GOSUB 860
226
+ 2540 GOTO 2900
227
+ 2550 REM--PLAYER WANTS TO BE HIT
228
+ 2560 GOSUB 300
229
+ 2570 H1=3
230
+ 2580 GOSUB 950
231
+ 2590 GOTO 2900
232
+ 2600 REM--PLAYER WANTS TO SPLIT
233
+ 2610 L1=P(I,1): IF P(I,1)>10 THEN L1=10
234
+ 2612 L2=P(I,2): IF P(I,2)>10 THEN L2=10
235
+ 2614 IF L1=L2 THEN 2640
236
+ 2620 PRINT "SPLITTING NOT ALLOWED."
237
+ 2630 GOTO 2370
238
+ 2640 REM--PLAY OUT SPLIT
239
+ 2650 I1=I+D1
240
+ 2660 R(I1)=2
241
+ 2670 P(I1,1)=P(I,2)
242
+ 2680 B(I+D1)=B(I)
243
+ 2690 GOSUB 100
244
+ 2700 PRINT "FIRST HAND RECEIVES A";
245
+ 2710 GOSUB 700
246
+ 2720 P(I,2)=X
247
+ 2730 GOSUB 300
248
+ 2740 PRINT
249
+ 2750 GOSUB 100
250
+ 2760 PRINT "SECOND HAND RECEIVES A";
251
+ 2770 I=I1
252
+ 2780 GOSUB 700
253
+ 2790 P(I,2)=X
254
+ 2800 GOSUB 300
255
+ 2810 PRINT
256
+ 2820 I=I1-D1
257
+ 2830 IF P(I,1)=1 THEN 2900
258
+ 2840 REM--NOW PLAY THE TWO HANDS
259
+ 2850 PRINT "HAND";1-(I>D1);
260
+ 2860 GOSUB 800
261
+ 2870 I=I+D1
262
+ 2880 IF I=I1 THEN 2850
263
+ 2890 I=I1-D1
264
+ 2900 NEXT I
265
+ 2910 GOSUB 300
266
+ 2920 REM--TEST FOR PLAYING DEALER'S HAND
267
+ 2930 FOR I=1 TO N
268
+ 2940 IF R(I)>0 OR R(I+D1)>0 THEN 3010
269
+ 2950 NEXT I
270
+ 2960 PRINT "DEALER HAD A";
271
+ 2970 X=P(D1,2)
272
+ 2980 GOSUB 700
273
+ 2990 PRINT " CONCEALED."
274
+ 3000 GOTO 3140
275
+ 3010 PRINT "DEALER HAS A";MID$(D$,3*P(D1,2)-2,3);" CONCEALED ";
276
+ 3020 I=D1
277
+ 3030 AA=Q(I): GOSUB 3400
278
+ 3035 PRINT "FOR A TOTAL OF";AA
279
+ 3040 IF AA>16 THEN 3130
280
+ 3050 PRINT "DRAWS";
281
+ 3060 GOSUB 100
282
+ 3070 GOSUB 750
283
+ 3080 GOSUB 1100
284
+ 3090 AA=Q: GOSUB 3400
285
+ 3095 IF Q>0 AND AA<17 THEN 3060
286
+ 3100 Q(I)=Q-(Q<0)/2
287
+ 3110 IF Q<0 THEN 3140
288
+ 3120 AA=Q: GOSUB 3400
289
+ 3125 PRINT "---TOTAL IS";AA
290
+ 3130 PRINT
291
+ 3140 REM--TALLY THE RESULT
292
+ 3150 REM
293
+ 3160 Z$="LOSES PUSHES WINS "
294
+ 3165 PRINT
295
+ 3170 FOR I=1 TO N
296
+ 3180 AA=Q(I): GOSUB 3400
297
+ 3182 AB=Q(I+D1): GOSUB 3410
298
+ 3184 AC=Q(D1): GOSUB 3420
299
+ 3186 S(I)=S(I)+B(I)*SGN(AA-AC)+B(I+D1)*SGN(AB-AC)
300
+ 3188 B(I+D1)=0
301
+ 3200 PRINT "PLAYER";I;
302
+ 3210 PRINT MID$(Z$,SGN(S(I))*6+7,6);" ";
303
+ 3220 IF S(I)<>0 THEN 3250
304
+ 3230 PRINT " ";
305
+ 3240 GOTO 3260
306
+ 3250 PRINT ABS(S(I));
307
+ 3260 T(I)=T(I)+S(I)
308
+ 3270 PRINT "TOTAL=";T(I)
309
+ 3280 GOSUB 1200
310
+ 3290 T(D1)=T(D1)-S(I)
311
+ 3300 I=I+D1
312
+ 3310 GOSUB 1200
313
+ 3320 I=I-D1
314
+ 3330 NEXT I
315
+ 3340 PRINT "DEALER'S TOTAL=";T(D1)
316
+ 3345 PRINT
317
+ 3350 GOSUB 1200
318
+ 3360 GOTO 1810
319
+ 3400 AA=AA+11*(AA>=22): RETURN
320
+ 3410 AB=AB+11*(AB>=22): RETURN
321
+ 3420 AC=AC+11*(AC>=22): RETURN
@@ -0,0 +1,26 @@
1
+ YES
2
+ 1
3
+ 10
4
+ H
5
+ N
6
+ S
7
+ 20
8
+ H
9
+ H
10
+ H
11
+ 40
12
+ H
13
+ S
14
+ 50
15
+ S
16
+ 60
17
+ H
18
+ 70
19
+ S
20
+ 10
21
+ NO
22
+ SPLIT
23
+ -1
24
+ 10
25
+ H
26
+