basic101 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/.simplecov +1 -0
- data/.yardopts +7 -0
- data/Changelog.md +3 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +75 -0
- data/LICENSE.md +9 -0
- data/README.md +193 -0
- data/Rakefile +14 -0
- data/VERSION +1 -0
- data/bin/basic101 +10 -0
- data/lib/basic101/abs_function.rb +19 -0
- data/lib/basic101/argument_checker.rb +61 -0
- data/lib/basic101/arguments.rb +32 -0
- data/lib/basic101/array_reference.rb +52 -0
- data/lib/basic101/asc_function.rb +17 -0
- data/lib/basic101/basic_array.rb +69 -0
- data/lib/basic101/basic_comparisons.rb +20 -0
- data/lib/basic101/basic_float.rb +48 -0
- data/lib/basic101/basic_integer.rb +48 -0
- data/lib/basic101/basic_math.rb +22 -0
- data/lib/basic101/basic_numeric.rb +96 -0
- data/lib/basic101/basic_object.rb +35 -0
- data/lib/basic101/basic_string.rb +85 -0
- data/lib/basic101/binary_operation.rb +32 -0
- data/lib/basic101/binary_operations.rb +26 -0
- data/lib/basic101/built_in_functions.rb +31 -0
- data/lib/basic101/chr_function.rb +17 -0
- data/lib/basic101/cos_function.rb +17 -0
- data/lib/basic101/data_statement.rb +24 -0
- data/lib/basic101/define_function_statement.rb +23 -0
- data/lib/basic101/dim_statement.rb +25 -0
- data/lib/basic101/else_statement.rb +22 -0
- data/lib/basic101/end_statement.rb +13 -0
- data/lib/basic101/endif_statement.rb +19 -0
- data/lib/basic101/errors.rb +50 -0
- data/lib/basic101/exp_function.rb +17 -0
- data/lib/basic101/for_stack.rb +48 -0
- data/lib/basic101/for_statement.rb +57 -0
- data/lib/basic101/function.rb +11 -0
- data/lib/basic101/function_call.rb +32 -0
- data/lib/basic101/function_identifier.rb +8 -0
- data/lib/basic101/functions.rb +39 -0
- data/lib/basic101/gosub_statement.rb +23 -0
- data/lib/basic101/goto_statement.rb +23 -0
- data/lib/basic101/identifier.rb +23 -0
- data/lib/basic101/identity.rb +18 -0
- data/lib/basic101/if_statement.rb +31 -0
- data/lib/basic101/input.rb +44 -0
- data/lib/basic101/input_reader.rb +55 -0
- data/lib/basic101/input_statement.rb +46 -0
- data/lib/basic101/int_function.rb +17 -0
- data/lib/basic101/left_function.rb +19 -0
- data/lib/basic101/len_function.rb +18 -0
- data/lib/basic101/let_statement.rb +24 -0
- data/lib/basic101/line.rb +32 -0
- data/lib/basic101/log_function.rb +17 -0
- data/lib/basic101/main.rb +24 -0
- data/lib/basic101/mid_function.rb +20 -0
- data/lib/basic101/negate_operation.rb +21 -0
- data/lib/basic101/next_statement.rb +34 -0
- data/lib/basic101/not_operation.rb +23 -0
- data/lib/basic101/null_prompt_delimeter.rb +12 -0
- data/lib/basic101/null_transcript.rb +20 -0
- data/lib/basic101/numeric_identifier.rb +16 -0
- data/lib/basic101/on_goto_statement.rb +29 -0
- data/lib/basic101/output.rb +73 -0
- data/lib/basic101/parser.rb +457 -0
- data/lib/basic101/power_operation.rb +24 -0
- data/lib/basic101/print_comma.rb +20 -0
- data/lib/basic101/print_semicolon.rb +19 -0
- data/lib/basic101/print_statement.rb +33 -0
- data/lib/basic101/program.rb +100 -0
- data/lib/basic101/program_counter.rb +52 -0
- data/lib/basic101/prompt_delimeter.rb +13 -0
- data/lib/basic101/randomize_statement.rb +13 -0
- data/lib/basic101/read_statement.rb +25 -0
- data/lib/basic101/reference.rb +25 -0
- data/lib/basic101/remark_statement.rb +12 -0
- data/lib/basic101/restore_statement.rb +23 -0
- data/lib/basic101/return_statement.rb +16 -0
- data/lib/basic101/right_function.rb +19 -0
- data/lib/basic101/rnd_function.rb +24 -0
- data/lib/basic101/runtime.rb +132 -0
- data/lib/basic101/scalar_reference.rb +19 -0
- data/lib/basic101/sgn_function.rb +17 -0
- data/lib/basic101/sin_function.rb +17 -0
- data/lib/basic101/sqr_function.rb +17 -0
- data/lib/basic101/statement.rb +36 -0
- data/lib/basic101/stop_statement.rb +14 -0
- data/lib/basic101/str_function.rb +16 -0
- data/lib/basic101/string_identifier.rb +16 -0
- data/lib/basic101/tab.rb +18 -0
- data/lib/basic101/tab_function.rb +17 -0
- data/lib/basic101/tan_function.rb +17 -0
- data/lib/basic101/transcript.rb +37 -0
- data/lib/basic101/transform.rb +264 -0
- data/lib/basic101/user_defined_function.rb +54 -0
- data/lib/basic101/val_function.rb +16 -0
- data/lib/basic101.rb +93 -0
- data/rake_tasks/default.rake +1 -0
- data/rake_tasks/integration.rake +8 -0
- data/rake_tasks/jeweler.rake +28 -0
- data/rake_tasks/spec.rake +8 -0
- data/rake_tasks/test.rake +2 -0
- data/rake_tasks/yard.rake +3 -0
- data/test/integration/arguments.rb +25 -0
- data/test/integration/errors.rb +7 -0
- data/test/integration/integration_test.rb +28 -0
- data/test/integration/main.rb +49 -0
- data/test/integration/output_file.rb +40 -0
- data/test/integration/test.rb +135 -0
- data/test/integration/tests/basic_computer_games/23-match.bas +64 -0
- data/test/integration/tests/basic_computer_games/23-match.input +1 -0
- data/test/integration/tests/basic_computer_games/23-match.output +29 -0
- data/test/integration/tests/basic_computer_games/3dplot.bas +17 -0
- data/test/integration/tests/basic_computer_games/3dplot.input +0 -0
- data/test/integration/tests/basic_computer_games/3dplot.output +47 -0
- data/test/integration/tests/basic_computer_games/aceyducy.bas +100 -0
- data/test/integration/tests/basic_computer_games/aceyducy.input +8 -0
- data/test/integration/tests/basic_computer_games/aceyducy.output +78 -0
- data/test/integration/tests/basic_computer_games/amazing.bas +138 -0
- data/test/integration/tests/basic_computer_games/amazing.input +1 -0
- data/test/integration/tests/basic_computer_games/amazing.output +32 -0
- data/test/integration/tests/basic_computer_games/animal.bas +71 -0
- data/test/integration/tests/basic_computer_games/animal.input +17 -0
- data/test/integration/tests/basic_computer_games/animal.output +38 -0
- data/test/integration/tests/basic_computer_games/awari.bas +70 -0
- data/test/integration/tests/basic_computer_games/awari.input +11 -0
- data/test/integration/tests/basic_computer_games/awari.output +117 -0
- data/test/integration/tests/basic_computer_games/bagels.bas +81 -0
- data/test/integration/tests/basic_computer_games/bagels.input +12 -0
- data/test/integration/tests/basic_computer_games/bagels.output +42 -0
- data/test/integration/tests/basic_computer_games/banner.bas +94 -0
- data/test/integration/tests/basic_computer_games/banner.input +6 -0
- data/test/integration/tests/basic_computer_games/banner.output +135 -0
- data/test/integration/tests/basic_computer_games/basketbl.bas +196 -0
- data/test/integration/tests/basic_computer_games/basketbl.input +46 -0
- data/test/integration/tests/basic_computer_games/basketbl.output +509 -0
- data/test/integration/tests/basic_computer_games/batnum.bas +90 -0
- data/test/integration/tests/basic_computer_games/batnum.input +14 -0
- data/test/integration/tests/basic_computer_games/batnum.output +67 -0
- data/test/integration/tests/basic_computer_games/battle.bas +196 -0
- data/test/integration/tests/basic_computer_games/battle.input +21 -0
- data/test/integration/tests/basic_computer_games/battle.output +118 -0
- data/test/integration/tests/basic_computer_games/blackjck.bas +321 -0
- data/test/integration/tests/basic_computer_games/blackjck.input +26 -0
- data/test/integration/tests/basic_computer_games/blackjck.output +144 -0
- data/test/integration/tests/basic_computer_games/bombard.bas +93 -0
- data/test/integration/tests/basic_computer_games/bombard.input +20 -0
- data/test/integration/tests/basic_computer_games/bombard.output +175 -0
- data/test/integration/tests/basic_computer_games/bounce.bas +53 -0
- data/test/integration/tests/basic_computer_games/bounce.input +0 -0
- data/test/integration/tests/basic_computer_games/bounce.output +15 -0
- data/test/integration/tests/basic_computer_games/bowling.bas +101 -0
- data/test/integration/tests/basic_computer_games/bowling.input +23 -0
- data/test/integration/tests/basic_computer_games/bowling.output +229 -0
- data/test/integration/tests/basic_computer_games/boxing.bas +142 -0
- data/test/integration/tests/basic_computer_games/boxing.input +8 -0
- data/test/integration/tests/basic_computer_games/boxing.output +47 -0
- data/test/integration/tests/basic_computer_games/bug.bas +256 -0
- data/test/integration/tests/basic_computer_games/bug.input +17 -0
- data/test/integration/tests/basic_computer_games/bug.output +847 -0
- data/test/integration/tests/basic_computer_games/bullfght.bas +193 -0
- data/test/integration/tests/basic_computer_games/bullfght.input +4 -0
- data/test/integration/tests/basic_computer_games/bullfght.output +60 -0
- data/test/integration/tests/basic_computer_games/bullseye.bas +37 -0
- data/test/integration/tests/basic_computer_games/bullseye.input +10 -0
- data/test/integration/tests/basic_computer_games/bullseye.output +79 -0
- data/test/integration/tests/basic_computer_games/bunny.bas +40 -0
- data/test/integration/tests/basic_computer_games/bunny.input +0 -0
- data/test/integration/tests/basic_computer_games/bunny.output +67 -0
- data/test/integration/tests/basic_computer_games/buzzword.bas +25 -0
- data/test/integration/tests/basic_computer_games/buzzword.input +4 -0
- data/test/integration/tests/basic_computer_games/buzzword.output +25 -0
- data/test/integration/tests/basic_computer_games/calendar.bas +58 -0
- data/test/integration/tests/basic_computer_games/calendar.input +0 -0
- data/test/integration/tests/basic_computer_games/calendar.output +213 -0
- data/test/integration/tests/basic_computer_games/change.bas +51 -0
- data/test/integration/tests/basic_computer_games/change.input +4 -0
- data/test/integration/tests/basic_computer_games/change.output +28 -0
- data/test/integration/tests/basic_computer_games/checkers.bas +82 -0
- data/test/integration/tests/basic_computer_games/checkers.input +74 -0
- data/test/integration/tests/basic_computer_games/checkers.output +673 -0
- data/test/integration/tests/basic_computer_games/chemist.bas +27 -0
- data/test/integration/tests/basic_computer_games/chemist.input +11 -0
- data/test/integration/tests/basic_computer_games/chemist.output +54 -0
- data/test/integration/tests/basic_computer_games/chief.bas +51 -0
- data/test/integration/tests/basic_computer_games/chief.input +5 -0
- data/test/integration/tests/basic_computer_games/chief.output +19 -0
- data/test/integration/tests/basic_computer_games/chomp.bas +104 -0
- data/test/integration/tests/basic_computer_games/chomp.input +15 -0
- data/test/integration/tests/basic_computer_games/chomp.output +159 -0
- data/test/integration/tests/basic_computer_games/combat.bas +124 -0
- data/test/integration/tests/basic_computer_games/combat.input +7 -0
- data/test/integration/tests/basic_computer_games/combat.output +33 -0
- data/test/integration/tests/basic_computer_games/craps.bas +82 -0
- data/test/integration/tests/basic_computer_games/craps.input +9 -0
- data/test/integration/tests/basic_computer_games/craps.output +51 -0
- data/test/integration/tests/basic_computer_games/cube.bas +161 -0
- data/test/integration/tests/basic_computer_games/cube.input +25 -0
- data/test/integration/tests/basic_computer_games/cube.output +72 -0
- data/test/integration/tests/basic_computer_games/depthchg.bas +33 -0
- data/test/integration/tests/basic_computer_games/depthchg.input +16 -0
- data/test/integration/tests/basic_computer_games/depthchg.output +83 -0
- data/test/integration/tests/basic_computer_games/diamond.bas +27 -0
- data/test/integration/tests/basic_computer_games/diamond.input +1 -0
- data/test/integration/tests/basic_computer_games/diamond.output +65 -0
- data/test/integration/tests/basic_computer_games/dice.bas +31 -0
- data/test/integration/tests/basic_computer_games/dice.input +4 -0
- data/test/integration/tests/basic_computer_games/dice.output +46 -0
- data/test/integration/tests/basic_computer_games/digits.bas +78 -0
- data/test/integration/tests/basic_computer_games/digits.input +5 -0
- data/test/integration/tests/basic_computer_games/digits.output +70 -0
- data/test/integration/tests/basic_computer_games/evenwin1.bas +128 -0
- data/test/integration/tests/basic_computer_games/evenwin1.input +13 -0
- data/test/integration/tests/basic_computer_games/evenwin1.output +116 -0
- data/test/integration/tests/basic_computer_games/evenwin2.bas +70 -0
- data/test/integration/tests/basic_computer_games/evenwin2.input +14 -0
- data/test/integration/tests/basic_computer_games/evenwin2.output +56 -0
- data/test/integration/tests/basic_computer_games/flipflop.bas +79 -0
- data/test/integration/tests/basic_computer_games/flipflop.input +8 -0
- data/test/integration/tests/basic_computer_games/flipflop.output +45 -0
- data/test/integration/tests/basic_computer_games/footbal1.bas +298 -0
- data/test/integration/tests/basic_computer_games/footbal1.input +13 -0
- data/test/integration/tests/basic_computer_games/footbal1.output +315 -0
- data/test/integration/tests/basic_computer_games/footbal2.bas +181 -0
- data/test/integration/tests/basic_computer_games/footbal2.input +23 -0
- data/test/integration/tests/basic_computer_games/footbal2.output +318 -0
- data/test/integration/tests/basic_computer_games/furtradr.bas +170 -0
- data/test/integration/tests/basic_computer_games/furtradr.input +20 -0
- data/test/integration/tests/basic_computer_games/furtradr.output +133 -0
- data/test/integration/tests/basic_computer_games/golf.bas +244 -0
- data/test/integration/tests/basic_computer_games/golf.input +11 -0
- data/test/integration/tests/basic_computer_games/golf.output +69 -0
- data/test/integration/tests/basic_computer_games/gomoko.bas +54 -0
- data/test/integration/tests/basic_computer_games/gomoko.input +6 -0
- data/test/integration/tests/basic_computer_games/gomoko.output +66 -0
- data/test/integration/tests/basic_computer_games/guess.bas +40 -0
- data/test/integration/tests/basic_computer_games/guess.input +8 -0
- data/test/integration/tests/basic_computer_games/guess.output +37 -0
- data/test/integration/tests/basic_computer_games/gunner.bas +52 -0
- data/test/integration/tests/basic_computer_games/gunner.input +18 -0
- data/test/integration/tests/basic_computer_games/gunner.output +91 -0
- data/test/integration/tests/basic_computer_games/hamurabi.bas +119 -0
- data/test/integration/tests/basic_computer_games/hamurabi.input +7 -0
- data/test/integration/tests/basic_computer_games/hamurabi.output +51 -0
- data/test/integration/tests/basic_computer_games/hangman.bas +81 -0
- data/test/integration/tests/basic_computer_games/hangman.input +69 -0
- data/test/integration/tests/basic_computer_games/hangman.output +889 -0
- data/test/integration/tests/basic_computer_games/hello.bas +83 -0
- data/test/integration/tests/basic_computer_games/hello.input +7 -0
- data/test/integration/tests/basic_computer_games/hello.output +46 -0
- data/test/integration/tests/basic_computer_games/hexapawn.bas +174 -0
- data/test/integration/tests/basic_computer_games/hexapawn.input +38 -0
- data/test/integration/tests/basic_computer_games/hexapawn.output +521 -0
- data/test/integration/tests/basic_computer_games/hi-q.bas +135 -0
- data/test/integration/tests/basic_computer_games/hi-q.input +14 -0
- data/test/integration/tests/basic_computer_games/hi-q.output +115 -0
- data/test/integration/tests/basic_computer_games/hilo.bas +29 -0
- data/test/integration/tests/basic_computer_games/hilo.input +20 -0
- data/test/integration/tests/basic_computer_games/hilo.output +76 -0
- data/test/integration/tests/basic_computer_games/hockey.bas +210 -0
- data/test/integration/tests/basic_computer_games/hockey.input +59 -0
- data/test/integration/tests/basic_computer_games/hockey.output +243 -0
- data/test/integration/tests/basic_computer_games/horsrace.bas +130 -0
- data/test/integration/tests/basic_computer_games/horsrace.input +11 -0
- data/test/integration/tests/basic_computer_games/horsrace.output +517 -0
- data/test/integration/tests/basic_computer_games/hurkle.bas +51 -0
- data/test/integration/tests/basic_computer_games/hurkle.input +16 -0
- data/test/integration/tests/basic_computer_games/hurkle.output +81 -0
- data/test/integration/tests/basic_computer_games/kinema.bas +34 -0
- data/test/integration/tests/basic_computer_games/kinema.input +9 -0
- data/test/integration/tests/basic_computer_games/kinema.output +64 -0
- data/test/integration/tests/basic_computer_games/king.bas +268 -0
- data/test/integration/tests/basic_computer_games/king.input +7 -0
- data/test/integration/tests/basic_computer_games/king.output +57 -0
- data/test/integration/tests/basic_computer_games/lem.bas +246 -0
- data/test/integration/tests/basic_computer_games/lem.input +4 -0
- data/test/integration/tests/basic_computer_games/lem.output +68 -0
- data/test/integration/tests/basic_computer_games/letter.bas +26 -0
- data/test/integration/tests/basic_computer_games/letter.input +24 -0
- data/test/integration/tests/basic_computer_games/letter.output +123 -0
- data/test/integration/tests/basic_computer_games/life.bas +66 -0
- data/test/integration/tests/basic_computer_games/life.input +4 -0
- data/test/integration/tests/basic_computer_games/life.options +1 -0
- data/test/integration/tests/basic_computer_games/life.output +200 -0
- data/test/integration/tests/basic_computer_games/life2.bas +83 -0
- data/test/integration/tests/basic_computer_games/life2.input +17 -0
- data/test/integration/tests/basic_computer_games/life2.output +113 -0
- data/test/integration/tests/basic_computer_games/litquiz.bas +49 -0
- data/test/integration/tests/basic_computer_games/litquiz.input +4 -0
- data/test/integration/tests/basic_computer_games/litquiz.output +36 -0
- data/test/integration/tests/basic_computer_games/love.bas +34 -0
- data/test/integration/tests/basic_computer_games/love.input +1 -0
- data/test/integration/tests/basic_computer_games/love.output +67 -0
- data/test/integration/tests/basic_computer_games/lunar.bas +48 -0
- data/test/integration/tests/basic_computer_games/lunar.input +87 -0
- data/test/integration/tests/basic_computer_games/lunar.output +195 -0
- data/test/integration/tests/basic_computer_games/mastrmnd.bas +232 -0
- data/test/integration/tests/basic_computer_games/mastrmnd.input +18 -0
- data/test/integration/tests/basic_computer_games/mastrmnd.output +67 -0
- data/test/integration/tests/basic_computer_games/mathdice.bas +60 -0
- data/test/integration/tests/basic_computer_games/mathdice.input +4 -0
- data/test/integration/tests/basic_computer_games/mathdice.output +86 -0
- data/test/integration/tests/basic_computer_games/mugwump.bas +56 -0
- data/test/integration/tests/basic_computer_games/mugwump.input +16 -0
- data/test/integration/tests/basic_computer_games/mugwump.output +139 -0
- data/test/integration/tests/basic_computer_games/name.bas +25 -0
- data/test/integration/tests/basic_computer_games/name.input +2 -0
- data/test/integration/tests/basic_computer_games/name.output +22 -0
- data/test/integration/tests/basic_computer_games/nicoma.bas +34 -0
- data/test/integration/tests/basic_computer_games/nicoma.input +8 -0
- data/test/integration/tests/basic_computer_games/nicoma.output +36 -0
- data/test/integration/tests/basic_computer_games/nim.bas +156 -0
- data/test/integration/tests/basic_computer_games/nim.input +8 -0
- data/test/integration/tests/basic_computer_games/nim.output +30 -0
- data/test/integration/tests/basic_computer_games/number.bas +37 -0
- data/test/integration/tests/basic_computer_games/number.input +19 -0
- data/test/integration/tests/basic_computer_games/number.output +73 -0
- data/test/integration/tests/basic_computer_games/onecheck.bas +86 -0
- data/test/integration/tests/basic_computer_games/onecheck.input +6 -0
- data/test/integration/tests/basic_computer_games/onecheck.output +77 -0
- data/test/integration/tests/basic_computer_games/orbit.bas +96 -0
- data/test/integration/tests/basic_computer_games/orbit.input +10 -0
- data/test/integration/tests/basic_computer_games/orbit.output +113 -0
- data/test/integration/tests/basic_computer_games/pizza.bas +68 -0
- data/test/integration/tests/basic_computer_games/pizza.input +10 -0
- data/test/integration/tests/basic_computer_games/pizza.output +93 -0
- data/test/integration/tests/basic_computer_games/poetry.bas +42 -0
- data/test/integration/tests/basic_computer_games/poetry.input +0 -0
- data/test/integration/tests/basic_computer_games/poetry.options +1 -0
- data/test/integration/tests/basic_computer_games/poetry.output +50 -0
- data/test/integration/tests/basic_computer_games/poker.bas +416 -0
- data/test/integration/tests/basic_computer_games/poker.input +34 -0
- data/test/integration/tests/basic_computer_games/poker.output +197 -0
- data/test/integration/tests/basic_computer_games/queen.bas +168 -0
- data/test/integration/tests/basic_computer_games/queen.input +10 -0
- data/test/integration/tests/basic_computer_games/queen.output +133 -0
- data/test/integration/tests/basic_computer_games/reverse.bas +62 -0
- data/test/integration/tests/basic_computer_games/reverse.input +12 -0
- data/test/integration/tests/basic_computer_games/reverse.output +79 -0
- data/test/integration/tests/basic_computer_games/rocket.bas +71 -0
- data/test/integration/tests/basic_computer_games/rocket.input +42 -0
- data/test/integration/tests/basic_computer_games/rocket.output +149 -0
- data/test/integration/tests/basic_computer_games/rocksp.bas +33 -0
- data/test/integration/tests/basic_computer_games/rocksp.input +9 -0
- data/test/integration/tests/basic_computer_games/rocksp.output +69 -0
- data/test/integration/tests/basic_computer_games/roulette.bas +239 -0
- data/test/integration/tests/basic_computer_games/roulette.input +9 -0
- data/test/integration/tests/basic_computer_games/roulette.output +98 -0
- data/test/integration/tests/basic_computer_games/rusrou.bas +26 -0
- data/test/integration/tests/basic_computer_games/rusrou.input +9 -0
- data/test/integration/tests/basic_computer_games/rusrou.output +50 -0
- data/test/integration/tests/basic_computer_games/salvo.bas +329 -0
- data/test/integration/tests/basic_computer_games/salvo.input +21 -0
- data/test/integration/tests/basic_computer_games/salvo.output +49 -0
- data/test/integration/tests/basic_computer_games/sinewave.bas +17 -0
- data/test/integration/tests/basic_computer_games/sinewave.input +0 -0
- data/test/integration/tests/basic_computer_games/sinewave.output +168 -0
- data/test/integration/tests/basic_computer_games/slalom.bas +165 -0
- data/test/integration/tests/basic_computer_games/slalom.input +20 -0
- data/test/integration/tests/basic_computer_games/slalom.output +122 -0
- data/test/integration/tests/basic_computer_games/slots.bas +134 -0
- data/test/integration/tests/basic_computer_games/slots.input +2 -0
- data/test/integration/tests/basic_computer_games/slots.output +20 -0
- data/test/integration/tests/basic_computer_games/splat.bas +128 -0
- data/test/integration/tests/basic_computer_games/splat.input +9 -0
- data/test/integration/tests/basic_computer_games/splat.output +61 -0
- data/test/integration/tests/basic_computer_games/stars.bas +54 -0
- data/test/integration/tests/basic_computer_games/stars.input +15 -0
- data/test/integration/tests/basic_computer_games/stars.output +70 -0
- data/test/integration/tests/basic_computer_games/stock.bas +232 -0
- data/test/integration/tests/basic_computer_games/stock.input +30 -0
- data/test/integration/tests/basic_computer_games/stock.output +156 -0
- data/test/integration/tests/basic_computer_games/superstartrek.bas +425 -0
- data/test/integration/tests/basic_computer_games/superstartrek.input +21 -0
- data/test/integration/tests/basic_computer_games/superstartrek.output +151 -0
- data/test/integration/tests/basic_computer_games/superstartrekins.bas +127 -0
- data/test/integration/tests/basic_computer_games/superstartrekins.input +1 -0
- data/test/integration/tests/basic_computer_games/superstartrekins.output +134 -0
- data/test/integration/tests/basic_computer_games/synonym.bas +53 -0
- data/test/integration/tests/basic_computer_games/synonym.input +13 -0
- data/test/integration/tests/basic_computer_games/synonym.output +57 -0
- data/test/integration/tests/basic_computer_games/target.bas +51 -0
- data/test/integration/tests/basic_computer_games/target.input +2 -0
- data/test/integration/tests/basic_computer_games/target.output +39 -0
- data/test/integration/tests/basic_computer_games/tictac1.bas +69 -0
- data/test/integration/tests/basic_computer_games/tictac1.input +10 -0
- data/test/integration/tests/basic_computer_games/tictac1.output +49 -0
- data/test/integration/tests/basic_computer_games/tictac2.bas +114 -0
- data/test/integration/tests/basic_computer_games/tictac2.input +6 -0
- data/test/integration/tests/basic_computer_games/tictac2.output +104 -0
- data/test/integration/tests/basic_computer_games/towers.bas +125 -0
- data/test/integration/tests/basic_computer_games/towers.input +9 -0
- data/test/integration/tests/basic_computer_games/towers.output +70 -0
- data/test/integration/tests/basic_computer_games/train.bas +24 -0
- data/test/integration/tests/basic_computer_games/train.input +4 -0
- data/test/integration/tests/basic_computer_games/train.output +23 -0
- data/test/integration/tests/basic_computer_games/trap.bas +49 -0
- data/test/integration/tests/basic_computer_games/trap.input +7 -0
- data/test/integration/tests/basic_computer_games/trap.output +40 -0
- data/test/integration/tests/basic_computer_games/war.bas +68 -0
- data/test/integration/tests/basic_computer_games/war.input +11 -0
- data/test/integration/tests/basic_computer_games/war.output +54 -0
- data/test/integration/tests/basic_computer_games/weekday.bas +150 -0
- data/test/integration/tests/basic_computer_games/weekday.input +2 -0
- data/test/integration/tests/basic_computer_games/weekday.output +28 -0
- data/test/integration/tests/basic_computer_games/word.bas +65 -0
- data/test/integration/tests/basic_computer_games/word.input +6 -0
- data/test/integration/tests/basic_computer_games/word.output +0 -0
- data/test/integration/tests/fast/abs.bas +5 -0
- data/test/integration/tests/fast/abs.input +0 -0
- data/test/integration/tests/fast/abs.output +5 -0
- data/test/integration/tests/fast/add.bas +5 -0
- data/test/integration/tests/fast/add.input +0 -0
- data/test/integration/tests/fast/add.output +5 -0
- data/test/integration/tests/fast/and.bas +5 -0
- data/test/integration/tests/fast/and.input +0 -0
- data/test/integration/tests/fast/and.output +5 -0
- data/test/integration/tests/fast/array.bas +11 -0
- data/test/integration/tests/fast/array.input +0 -0
- data/test/integration/tests/fast/array.output +6 -0
- data/test/integration/tests/fast/asc.bas +1 -0
- data/test/integration/tests/fast/asc.input +0 -0
- data/test/integration/tests/fast/asc.output +1 -0
- data/test/integration/tests/fast/chr.bas +1 -0
- data/test/integration/tests/fast/chr.input +0 -0
- data/test/integration/tests/fast/chr.output +1 -0
- data/test/integration/tests/fast/cos.bas +1 -0
- data/test/integration/tests/fast/cos.input +0 -0
- data/test/integration/tests/fast/cos.output +1 -0
- data/test/integration/tests/fast/def_fn.bas +9 -0
- data/test/integration/tests/fast/def_fn.input +0 -0
- data/test/integration/tests/fast/def_fn.output +5 -0
- data/test/integration/tests/fast/divide.bas +5 -0
- data/test/integration/tests/fast/divide.input +0 -0
- data/test/integration/tests/fast/divide.output +5 -0
- data/test/integration/tests/fast/end.bas +3 -0
- data/test/integration/tests/fast/end.input +0 -0
- data/test/integration/tests/fast/end.output +1 -0
- data/test/integration/tests/fast/eq.bas +3 -0
- data/test/integration/tests/fast/eq.input +0 -0
- data/test/integration/tests/fast/eq.output +3 -0
- data/test/integration/tests/fast/exp.bas +2 -0
- data/test/integration/tests/fast/exp.input +0 -0
- data/test/integration/tests/fast/exp.output +2 -0
- data/test/integration/tests/fast/float.bas +3 -0
- data/test/integration/tests/fast/float.input +0 -0
- data/test/integration/tests/fast/float.output +2 -0
- data/test/integration/tests/fast/for_next.bas +61 -0
- data/test/integration/tests/fast/for_next.input +0 -0
- data/test/integration/tests/fast/for_next.output +46 -0
- data/test/integration/tests/fast/ge.bas +3 -0
- data/test/integration/tests/fast/ge.input +0 -0
- data/test/integration/tests/fast/ge.output +3 -0
- data/test/integration/tests/fast/gosub_return.bas +10 -0
- data/test/integration/tests/fast/gosub_return.input +0 -0
- data/test/integration/tests/fast/gosub_return.output +4 -0
- data/test/integration/tests/fast/goto.bas +3 -0
- data/test/integration/tests/fast/goto.input +0 -0
- data/test/integration/tests/fast/goto.output +1 -0
- data/test/integration/tests/fast/gt.bas +3 -0
- data/test/integration/tests/fast/gt.input +0 -0
- data/test/integration/tests/fast/gt.output +3 -0
- data/test/integration/tests/fast/if.bas +25 -0
- data/test/integration/tests/fast/if.input +0 -0
- data/test/integration/tests/fast/if.output +8 -0
- data/test/integration/tests/fast/input.bas +24 -0
- data/test/integration/tests/fast/input.input +10 -0
- data/test/integration/tests/fast/input.output +28 -0
- data/test/integration/tests/fast/int.bas +5 -0
- data/test/integration/tests/fast/int.input +0 -0
- data/test/integration/tests/fast/int.output +5 -0
- data/test/integration/tests/fast/integer_plus_string.bas +1 -0
- data/test/integration/tests/fast/integer_plus_string.input +0 -0
- data/test/integration/tests/fast/integer_plus_string.output +1 -0
- data/test/integration/tests/fast/invalid_argument.bas +1 -0
- data/test/integration/tests/fast/invalid_argument.input +0 -0
- data/test/integration/tests/fast/invalid_argument.output +1 -0
- data/test/integration/tests/fast/le.bas +3 -0
- data/test/integration/tests/fast/le.input +0 -0
- data/test/integration/tests/fast/le.output +3 -0
- data/test/integration/tests/fast/left.bas +1 -0
- data/test/integration/tests/fast/left.input +0 -0
- data/test/integration/tests/fast/left.output +1 -0
- data/test/integration/tests/fast/len.bas +2 -0
- data/test/integration/tests/fast/len.input +0 -0
- data/test/integration/tests/fast/len.output +2 -0
- data/test/integration/tests/fast/let.bas +6 -0
- data/test/integration/tests/fast/let.input +0 -0
- data/test/integration/tests/fast/let.output +4 -0
- data/test/integration/tests/fast/log.bas +1 -0
- data/test/integration/tests/fast/log.input +0 -0
- data/test/integration/tests/fast/log.output +1 -0
- data/test/integration/tests/fast/lt.bas +3 -0
- data/test/integration/tests/fast/lt.input +0 -0
- data/test/integration/tests/fast/lt.output +3 -0
- data/test/integration/tests/fast/math.output +0 -0
- data/test/integration/tests/fast/mid.bas +2 -0
- data/test/integration/tests/fast/mid.input +0 -0
- data/test/integration/tests/fast/mid.output +2 -0
- data/test/integration/tests/fast/multiply.bas +5 -0
- data/test/integration/tests/fast/multiply.input +0 -0
- data/test/integration/tests/fast/multiply.output +5 -0
- data/test/integration/tests/fast/ne.bas +3 -0
- data/test/integration/tests/fast/ne.input +0 -0
- data/test/integration/tests/fast/ne.output +3 -0
- data/test/integration/tests/fast/negate.bas +4 -0
- data/test/integration/tests/fast/negate.input +0 -0
- data/test/integration/tests/fast/negate.output +3 -0
- data/test/integration/tests/fast/not.bas +4 -0
- data/test/integration/tests/fast/not.input +0 -0
- data/test/integration/tests/fast/not.output +4 -0
- data/test/integration/tests/fast/on_goto.bas +6 -0
- data/test/integration/tests/fast/on_goto.input +0 -0
- data/test/integration/tests/fast/on_goto.output +2 -0
- data/test/integration/tests/fast/or.bas +5 -0
- data/test/integration/tests/fast/or.input +0 -0
- data/test/integration/tests/fast/or.output +5 -0
- data/test/integration/tests/fast/parentheses.bas +1 -0
- data/test/integration/tests/fast/parentheses.input +0 -0
- data/test/integration/tests/fast/parentheses.output +1 -0
- data/test/integration/tests/fast/power.bas +4 -0
- data/test/integration/tests/fast/power.input +0 -0
- data/test/integration/tests/fast/power.output +4 -0
- data/test/integration/tests/fast/print.bas +6 -0
- data/test/integration/tests/fast/print.input +0 -0
- data/test/integration/tests/fast/print.output +4 -0
- data/test/integration/tests/fast/read_data.bas +15 -0
- data/test/integration/tests/fast/read_data.input +0 -0
- data/test/integration/tests/fast/read_data.output +4 -0
- data/test/integration/tests/fast/rem.bas +1 -0
- data/test/integration/tests/fast/rem.input +0 -0
- data/test/integration/tests/fast/rem.output +0 -0
- data/test/integration/tests/fast/right.bas +1 -0
- data/test/integration/tests/fast/right.input +0 -0
- data/test/integration/tests/fast/right.output +1 -0
- data/test/integration/tests/fast/rnd.bas +5 -0
- data/test/integration/tests/fast/rnd.input +0 -0
- data/test/integration/tests/fast/rnd.output +5 -0
- data/test/integration/tests/fast/sgn.bas +5 -0
- data/test/integration/tests/fast/sgn.input +0 -0
- data/test/integration/tests/fast/sgn.output +5 -0
- data/test/integration/tests/fast/sin.bas +1 -0
- data/test/integration/tests/fast/sin.input +0 -0
- data/test/integration/tests/fast/sin.output +1 -0
- data/test/integration/tests/fast/sqr.bas +2 -0
- data/test/integration/tests/fast/sqr.input +0 -0
- data/test/integration/tests/fast/sqr.output +2 -0
- data/test/integration/tests/fast/stop.bas +3 -0
- data/test/integration/tests/fast/stop.input +0 -0
- data/test/integration/tests/fast/stop.output +2 -0
- data/test/integration/tests/fast/str.bas +3 -0
- data/test/integration/tests/fast/str.input +0 -0
- data/test/integration/tests/fast/str.output +3 -0
- data/test/integration/tests/fast/string_addition.bas +1 -0
- data/test/integration/tests/fast/string_addition.input +0 -0
- data/test/integration/tests/fast/string_addition.output +1 -0
- data/test/integration/tests/fast/string_comparisons.bas +7 -0
- data/test/integration/tests/fast/string_comparisons.input +0 -0
- data/test/integration/tests/fast/string_comparisons.output +4 -0
- data/test/integration/tests/fast/string_plus_integer.bas +1 -0
- data/test/integration/tests/fast/string_plus_integer.input +0 -0
- data/test/integration/tests/fast/string_plus_integer.output +1 -0
- data/test/integration/tests/fast/subtract.bas +5 -0
- data/test/integration/tests/fast/subtract.input +0 -0
- data/test/integration/tests/fast/subtract.output +5 -0
- data/test/integration/tests/fast/tab.bas +4 -0
- data/test/integration/tests/fast/tab.input +0 -0
- data/test/integration/tests/fast/tab.output +3 -0
- data/test/integration/tests/fast/tan.bas +1 -0
- data/test/integration/tests/fast/tan.input +0 -0
- data/test/integration/tests/fast/tan.output +1 -0
- data/test/integration/tests/fast/val.bas +3 -0
- data/test/integration/tests/fast/val.input +0 -0
- data/test/integration/tests/fast/val.output +3 -0
- data/test/spec/argument_checker_spec.rb +128 -0
- data/test/spec/basic_array_spec.rb +100 -0
- data/test/spec/basic_float_spec.rb +168 -0
- data/test/spec/basic_integer_spec.rb +270 -0
- data/test/spec/basic_numeric_spec.rb +16 -0
- data/test/spec/basic_object_spec.rb +22 -0
- data/test/spec/basic_string_spec.rb +259 -0
- data/test/spec/for_stack_spec.rb +70 -0
- data/test/spec/input_reader_spec.rb +143 -0
- data/test/spec/input_spec.rb +102 -0
- data/test/spec/line_spec.rb +18 -0
- data/test/spec/output_spec.rb +153 -0
- data/test/spec/parser_spec.rb +562 -0
- data/test/spec/program_spec.rb +45 -0
- data/test/spec/spec_helper.rb +15 -0
- data/test/spec/support/basic_numeric_helpers.rb +327 -0
- data/test/spec/support/basic_object_helpers.rb +22 -0
- data/test/spec/transcript_spec.rb +37 -0
- data/test/spec/transform_spec.rb +513 -0
- 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,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
|