basic101 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,83 @@
|
|
1
|
+
2 PRINT TAB(33);"HELLO"
|
2
|
+
4 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
|
3
|
+
6 PRINT: PRINT: PRINT
|
4
|
+
10 PRINT "HELLO. MY NAME IS CREATIVE COMPUTER."
|
5
|
+
20 PRINT: PRINT: INPUT "WHAT'S YOUR NAME";N$: PRINT
|
6
|
+
30 PRINT "HI THERE, ";N$;", ARE YOU ENJOYING YOURSELF HERE";
|
7
|
+
40 INPUT B$: PRINT
|
8
|
+
50 IF B$="YES" THEN 70
|
9
|
+
55 IF B$="NO" THEN 80
|
10
|
+
60 PRINT N$;", I DON'T UNDERSTAND YOUR ANSWER OF '";B$;"'."
|
11
|
+
65 PRINT "PLEASE ANSWER 'YES' OR 'NO'. DO YOU LIKE IT HERE";: GOTO 40
|
12
|
+
70 PRINT "I'M GLAD TO HEAR THAT, ";N$;".": PRINT
|
13
|
+
75 GOTO 100
|
14
|
+
80 PRINT "OH, I'M SORRY TO HEAR THAT, ";N$;". MAYBE WE CAN"
|
15
|
+
85 PRINT "BRIGHTEN UP YOUR VISIT A BIT."
|
16
|
+
100 PRINT
|
17
|
+
105 PRINT "SAY, ";N$;", I CAN SOLVE ALL KINDS OF PROBLEMS EXCEPT"
|
18
|
+
110 PRINT "THOSE DEALING WITH GREECE. WHAT KIND OF PROBLEMS DO"
|
19
|
+
120 PRINT "YOU HAVE (ANSWER SEX, HEALTH, MONEY, OR JOB)";
|
20
|
+
125 INPUT C$
|
21
|
+
126 PRINT
|
22
|
+
130 IF C$="SEX" THEN 200
|
23
|
+
132 IF C$="HEALTH" THEN 180
|
24
|
+
134 IF C$="MONEY" THEN 160
|
25
|
+
136 IF C$="JOB" THEN 145
|
26
|
+
138 PRINT "OH, ";N$;", YOUR ANSWER OF ";C$;" IS GREEK TO ME."
|
27
|
+
140 GOTO 250
|
28
|
+
145 PRINT "I CAN SYMPATHIZE WITH YOU ";N$;". I HAVE TO WORK"
|
29
|
+
148 PRINT "VERY LONG HOURS FOR NO PAY -- AND SOME OF MY BOSSES"
|
30
|
+
150 PRINT "REALLY BEAT ON MY KEYBOARD. MY ADVICE TO YOU, ";N$;","
|
31
|
+
153 PRINT "IS TO OPEN A RETAIL COMPUTER STORE. IT'S GREAT FUN."
|
32
|
+
155 GOTO 250
|
33
|
+
160 PRINT "SORRY, ";N$;", I'M BROKE TOO. WHY DON'T YOU SELL"
|
34
|
+
162 PRINT "ENCYCLOPEADIAS OR MARRY SOMEONE RICH OR STOP EATING"
|
35
|
+
164 PRINT "SO YOU WON'T NEED SO MUCH MONEY?"
|
36
|
+
170 GOTO 250
|
37
|
+
180 PRINT "MY ADVICE TO YOU ";N$;" IS:"
|
38
|
+
185 PRINT " 1. TAKE TWO ASPRIN"
|
39
|
+
188 PRINT " 2. DRINK PLENTY OF FLUIDS (ORANGE JUICE, NOT BEER!)"
|
40
|
+
190 PRINT " 3. GO TO BED (ALONE)"
|
41
|
+
195 GOTO 250
|
42
|
+
200 INPUT "IS YOUR PROBLEM TOO MUCH OR TOO LITTLE";D$: PRINT
|
43
|
+
210 IF D$="TOO MUCH" THEN 220
|
44
|
+
212 IF D$="TOO LITTLE" THEN 230
|
45
|
+
215 PRINT "DON'T GET ALL SHOOK, ";N$;", JUST ANSWER THE QUESTION"
|
46
|
+
217 INPUT "WITH 'TOO MUCH' OR 'TOO LITTLE'. WHICH IS IT";D$:GOTO 210
|
47
|
+
220 PRINT "YOU CALL THAT A PROBLEM?!! I SHOULD HAVE SUCH PROBLEMS!"
|
48
|
+
225 PRINT "IF IT BOTHERS YOU, ";N$;", TAKE A COLD SHOWER."
|
49
|
+
228 GOTO 250
|
50
|
+
230 PRINT "WHY ARE YOU HERE IN SUFFERN, ";N$;"? YOU SHOULD BE"
|
51
|
+
235 PRINT "IN TOKYO OR NEW YORK OR AMSTERDAM OR SOMEPLACE WITH SOME"
|
52
|
+
240 PRINT "REAL ACTION."
|
53
|
+
250 PRINT
|
54
|
+
255 PRINT "ANY MORE PROBLEMS YOU WANT SOLVED, ";N$;
|
55
|
+
260 INPUT E$: PRINT
|
56
|
+
270 IF E$="YES" THEN 280
|
57
|
+
273 IF E$="NO" THEN 300
|
58
|
+
275 PRINT "JUST A SIMPLE 'YES' OR 'NO' PLEASE, ";N$;"."
|
59
|
+
277 GOTO 255
|
60
|
+
280 PRINT "WHAT KIND (SEX, MONEY, HEALTH, JOB)";
|
61
|
+
282 GOTO 125
|
62
|
+
300 PRINT
|
63
|
+
302 PRINT "THAT WILL BE $5.00 FOR THE ADVICE, ";N$;"."
|
64
|
+
305 PRINT "PLEASE LEAVE THE MONEY ON THE TERMINAL."
|
65
|
+
307 FOR I=1 TO 2000: NEXT I
|
66
|
+
310 PRINT: PRINT: PRINT
|
67
|
+
315 PRINT "DID YOU LEAVE THE MONEY";
|
68
|
+
320 INPUT G$: PRINT
|
69
|
+
325 IF G$="YES" THEN 350
|
70
|
+
330 IF G$="NO" THEN 370
|
71
|
+
335 PRINT "YOUR ANSWER OF '";G$;"' CONFUSES ME, ";N$;"."
|
72
|
+
340 PRINT "PLEASE RESPOND WITH 'YES' OR 'NO'.": GOTO 315
|
73
|
+
350 PRINT "HEY, ";N$;"??? YOU LEFT NO MONEY AT ALL!"
|
74
|
+
355 PRINT "YOU ARE CHEATING ME OUT OF MY HARD-EARNED LIVING."
|
75
|
+
360 PRINT:PRINT "WHAT A RIP OFF, ";N$;"!!!":PRINT
|
76
|
+
365 GOTO 385
|
77
|
+
370 PRINT "THAT'S HONEST, ";N$;", BUT HOW DO YOU EXPECT"
|
78
|
+
375 PRINT "ME TO GO ON WITH MY PSYCHOLOGY STUDIES IF MY PATIENTS"
|
79
|
+
380 PRINT "DON'T PAY THEIR BILLS?"
|
80
|
+
385 PRINT:PRINT "TAKE A WALK, ";N$;".":PRINT:PRINT:GOTO 999
|
81
|
+
390 PRINT "NICE MEETING YOU, ";N$;", HAVE A NICE DAY."
|
82
|
+
400 REM
|
83
|
+
999 END
|
@@ -0,0 +1,46 @@
|
|
1
|
+
HELLO
|
2
|
+
CREATIVE COMPUTING MORRISTOWN, NEW JERSEY
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
HELLO. MY NAME IS CREATIVE COMPUTER.
|
7
|
+
|
8
|
+
|
9
|
+
WHAT'S YOUR NAME? FRED
|
10
|
+
|
11
|
+
HI THERE, FRED, ARE YOU ENJOYING YOURSELF HERE? NO
|
12
|
+
|
13
|
+
OH, I'M SORRY TO HEAR THAT, FRED. MAYBE WE CAN
|
14
|
+
BRIGHTEN UP YOUR VISIT A BIT.
|
15
|
+
|
16
|
+
SAY, FRED, I CAN SOLVE ALL KINDS OF PROBLEMS EXCEPT
|
17
|
+
THOSE DEALING WITH GREECE. WHAT KIND OF PROBLEMS DO
|
18
|
+
YOU HAVE (ANSWER SEX, HEALTH, MONEY, OR JOB)? GREECE
|
19
|
+
|
20
|
+
OH, FRED, YOUR ANSWER OF GREECE IS GREEK TO ME.
|
21
|
+
|
22
|
+
ANY MORE PROBLEMS YOU WANT SOLVED, FRED? YES
|
23
|
+
|
24
|
+
WHAT KIND (SEX, MONEY, HEALTH, JOB)? MONEY
|
25
|
+
|
26
|
+
SORRY, FRED, I'M BROKE TOO. WHY DON'T YOU SELL
|
27
|
+
ENCYCLOPEADIAS OR MARRY SOMEONE RICH OR STOP EATING
|
28
|
+
SO YOU WON'T NEED SO MUCH MONEY?
|
29
|
+
|
30
|
+
ANY MORE PROBLEMS YOU WANT SOLVED, FRED? NO
|
31
|
+
|
32
|
+
|
33
|
+
THAT WILL BE $5.00 FOR THE ADVICE, FRED.
|
34
|
+
PLEASE LEAVE THE MONEY ON THE TERMINAL.
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
DID YOU LEAVE THE MONEY? NO
|
39
|
+
|
40
|
+
THAT'S HONEST, FRED, BUT HOW DO YOU EXPECT
|
41
|
+
ME TO GO ON WITH MY PSYCHOLOGY STUDIES IF MY PATIENTS
|
42
|
+
DON'T PAY THEIR BILLS?
|
43
|
+
|
44
|
+
TAKE A WALK, FRED.
|
45
|
+
|
46
|
+
|
@@ -0,0 +1,174 @@
|
|
1
|
+
1 PRINT TAB(32);"HEXAPAWN"
|
2
|
+
2 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
|
3
|
+
3 PRINT:PRINT:PRINT
|
4
|
+
4 REM HEXAPAWN: INTERPRETATION OF HEXAPAWN GAME AS PRESENTED IN
|
5
|
+
5 REM MARTIN GARDNER'S "THE UNEXPECTED HANGING AND OTHER MATHEMATIC-
|
6
|
+
6 REM AL DIVERSIONS", CHAPTER EIGHT: A MATCHBOX GAME-LEARNING MACHINE
|
7
|
+
7 REM ORIGINAL VERSION FOR H-P TIMESHARE SYSTEM BY R.A. KAAPKE 5/5/76
|
8
|
+
8 REM INSTRUCTIONS BY JEFF DALTON
|
9
|
+
9 REM CONVERSION TO MITS BASIC BY STEVE NORTH
|
10
|
+
10 DIM B(19,9),M(19,4),S(9),P$(3)
|
11
|
+
15 W=0: L=0
|
12
|
+
20 DEF FNR(X)=-3*(X=1)-(X=3)-4*(X=6)-6*(X=4)-7*(X=9)-9*(X=7)+FNS(X)
|
13
|
+
25 DEF FNS(X)=-X*(X=2 OR X=5 OR X=8)
|
14
|
+
30 DEF FNM(Y)=Y-INT(Y/10)*10
|
15
|
+
35 P$="X.O"
|
16
|
+
40 FOR I=1 TO 19: FOR J=1 TO 9: READ B(I,J): NEXT J: NEXT I
|
17
|
+
45 FOR I=1 TO 19: FOR J=1 TO 4: READ M(I,J): NEXT J: NEXT I
|
18
|
+
50 PRINT "INSTRUCTIONS (Y-N)";
|
19
|
+
60 INPUT A$
|
20
|
+
70 A$=LEFT$(A$,1)
|
21
|
+
80 IF A$="Y" THEN 2000
|
22
|
+
90 IF A$<>"N" THEN 50
|
23
|
+
100 X=0: Y=0
|
24
|
+
111 S(4)=0: S(5)=0: S(6)=0
|
25
|
+
112 S(1)=-1: S(2)=-1: S(3)=-1
|
26
|
+
113 S(7)=1: S(8)=1: S(9)=1
|
27
|
+
115 GOSUB 1000
|
28
|
+
120 PRINT "YOUR MOVE";
|
29
|
+
121 INPUT M1,M2
|
30
|
+
122 IF M1=INT(M1)AND M2=INT(M2)AND M1>0 AND M1<10 AND M2>0 AND M2<10 THEN 130
|
31
|
+
123 PRINT "ILLEGAL CO-ORDINATES."
|
32
|
+
124 GOTO 120
|
33
|
+
130 IF S(M1)=1 THEN 150
|
34
|
+
140 PRINT "ILLEGAL MOVE.": GOTO 120
|
35
|
+
150 IF S(M2)=1 THEN 140
|
36
|
+
160 IF M2-M1<>-3 AND S(M2)<>-1 THEN 140
|
37
|
+
170 IF M2>M1 THEN 140
|
38
|
+
180 IF M2-M1=-3 AND (S(M2)<>0) THEN 140
|
39
|
+
185 IF M2-M1<-4 THEN 140
|
40
|
+
186 IF M1=7 AND M2=3 THEN 140
|
41
|
+
190 S(M1)=0
|
42
|
+
200 S(M2)=1
|
43
|
+
205 GOSUB 1000
|
44
|
+
210 IF S(1)=1 OR S(2)=1 OR S(3)=1 THEN 820
|
45
|
+
220 FOR I=1 TO 9
|
46
|
+
221 IF S(I)=-1 THEN 230
|
47
|
+
222 NEXT I
|
48
|
+
223 GOTO 820
|
49
|
+
230 FOR I=1 TO 9
|
50
|
+
240 IF S(I)<>-1 THEN 330
|
51
|
+
250 IF S(I+3)=0 THEN 350
|
52
|
+
260 IF FNR(I)=I THEN 320
|
53
|
+
270 IF I>3 THEN 300
|
54
|
+
280 IF S(5)=1 THEN 350
|
55
|
+
290 GOTO 330
|
56
|
+
300 IF S(8)=1 THEN 350
|
57
|
+
310 GOTO 330
|
58
|
+
320 IF S(I+2)=1 OR S(I+4)=1 THEN 350
|
59
|
+
330 NEXT I
|
60
|
+
340 GOTO 820
|
61
|
+
350 FOR I=1 TO 19
|
62
|
+
360 FOR J=1 TO 3
|
63
|
+
370 FOR K=3 TO 1 STEP -1
|
64
|
+
380 T((J-1)*3+K)=B(I,(J-1)*3+4-K)
|
65
|
+
390 NEXT K
|
66
|
+
400 NEXT J
|
67
|
+
410 FOR J=1 TO 9
|
68
|
+
420 IF S(J)<>B(I,J) THEN 460
|
69
|
+
430 NEXT J
|
70
|
+
440 R=0
|
71
|
+
450 GOTO 540
|
72
|
+
460 FOR J=1 TO 9
|
73
|
+
470 IF S(J)<>T(J) THEN 510
|
74
|
+
480 NEXT J
|
75
|
+
490 R=1
|
76
|
+
500 GOTO 540
|
77
|
+
510 NEXT I
|
78
|
+
511 REMEMBER THE TERMINATION OF THIS LOOP IS IMPOSSIBLE
|
79
|
+
512 PRINT "ILLEGAL BOARD PATTERN."
|
80
|
+
530 STOP
|
81
|
+
540 X=I
|
82
|
+
550 FOR I=1 TO 4
|
83
|
+
560 IF M(X,I)<>0 THEN 600
|
84
|
+
570 NEXT I
|
85
|
+
580 PRINT "I RESIGN."
|
86
|
+
590 GOTO 820
|
87
|
+
600 Y=INT(RND(1)*4+1)
|
88
|
+
601 IF M(X,Y)=0 THEN 600
|
89
|
+
610 IF R<>0 THEN 630
|
90
|
+
620 PRINT "I MOVE FROM ";STR$(INT(M(X,Y)/10));" TO ";STR$(FNM(M(X,Y)))
|
91
|
+
622 S(INT(M(X,Y)/10))=0
|
92
|
+
623 S(FNM(M(X,Y)))=-1
|
93
|
+
624 GOTO 640
|
94
|
+
630 PRINT "I MOVE FROM ";STR$(FNR(INT(M(X,Y)/10)));" TO ";
|
95
|
+
631 PRINT STR$(FNR(FNM(M(X,Y))))
|
96
|
+
632 S(FNR(INT(M(X,Y)/10)))=0
|
97
|
+
633 S(FNR(FNM(M(X,Y))))=-1
|
98
|
+
640 GOSUB 1000
|
99
|
+
641 IF S(7)=-1 OR S(8)=-1 OR S(9)=-1 THEN 870
|
100
|
+
650 FOR I=1 TO 9
|
101
|
+
660 IF S(I)=1 THEN 690
|
102
|
+
670 NEXT I
|
103
|
+
680 GOTO 870
|
104
|
+
690 FOR I=1 TO 9
|
105
|
+
700 IF S(I)<>1 THEN 790
|
106
|
+
710 IF S(I-3)=0 THEN 120
|
107
|
+
720 IF FNR(I)=I THEN 780
|
108
|
+
730 IF I<7 THEN 760
|
109
|
+
740 IF S(5)=-1 THEN 120
|
110
|
+
750 GOTO 790
|
111
|
+
760 IF S(2)=-1 THEN 120
|
112
|
+
770 GOTO 790
|
113
|
+
780 IF S(I-2)=-1 OR S(I-4)=-1 THEN 120
|
114
|
+
790 NEXT I
|
115
|
+
800 PRINT "YOU CAN'T MOVE, SO ";
|
116
|
+
810 GOTO 870
|
117
|
+
820 PRINT "YOU WIN."
|
118
|
+
830 M(X,Y)=0
|
119
|
+
840 L=L+1
|
120
|
+
850 PRINT "I HAVE WON";W;"AND YOU";L;"OUT OF";L+W;"GAMES."
|
121
|
+
851 PRINT
|
122
|
+
860 GOTO 100
|
123
|
+
870 PRINT "I WIN."
|
124
|
+
880 W=W+1
|
125
|
+
890 GOTO 850
|
126
|
+
900 DATA -1,-1,-1,1,0,0,0,1,1,-1,-1,-1,0,1,0,1,0,1
|
127
|
+
905 DATA -1,0,-1,-1,1,0,0,0,1,0,-1,-1,1,-1,0,0,0,1
|
128
|
+
910 DATA -1,0,-1,1,1,0,0,1,0,-1,-1,0,1,0,1,0,0,1
|
129
|
+
915 DATA 0,-1,-1,0,-1,1,1,0,0,0,-1,-1,-1,1,1,1,0,0
|
130
|
+
920 DATA -1,0,-1,-1,0,1,0,1,0,0,-1,-1,0,1,0,0,0,1
|
131
|
+
925 DATA 0,-1,-1,0,1,0,1,0,0,-1,0,-1,1,0,0,0,0,1
|
132
|
+
930 DATA 0,0,-1,-1,-1,1,0,0,0,-1,0,0,1,1,1,0,0,0
|
133
|
+
935 DATA 0,-1,0,-1,1,1,0,0,0,-1,0,0,-1,-1,1,0,0,0
|
134
|
+
940 DATA 0,0,-1,-1,1,0,0,0,0,0,-1,0,1,-1,0,0,0,0
|
135
|
+
945 DATA -1,0,0,-1,1,0,0,0,0
|
136
|
+
950 DATA 24,25,36,0,14,15,36,0,15,35,36,47,36,58,59,0
|
137
|
+
955 DATA 15,35,36,0,24,25,26,0,26,57,58,0
|
138
|
+
960 DATA 26,35,0,0,47,48,0,0,35,36,0,0,35,36,0,0
|
139
|
+
965 DATA 36,0,0,0,47,58,0,0,15,0,0,0
|
140
|
+
970 DATA 26,47,0,0,47,58,0,0,35,36,47,0,28,58,0,0,15,47,0,0
|
141
|
+
1000 PRINT
|
142
|
+
1010 FOR I=1 TO 3
|
143
|
+
1020 FOR J=1 TO 3
|
144
|
+
1030 PRINT TAB(10);MID$(P$,S((I-1)*3+J)+2,1);
|
145
|
+
1040 NEXT J
|
146
|
+
1050 PRINT
|
147
|
+
1060 NEXT I
|
148
|
+
1070 PRINT
|
149
|
+
1080 RETURN
|
150
|
+
2000 PRINT: PRINT "THIS PROGRAM PLAYS THE GAME OF HEXAPAWN."
|
151
|
+
2010 PRINT "HEXAPAWN IS PLAYED WITH CHESS PAWNS ON A 3 BY 3 BOARD."
|
152
|
+
2020 PRINT "THE PAWNS ARE MOVED AS IN CHESS - ONE SPACE FORWARD TO"
|
153
|
+
2030 PRINT "AN EMPTY SPACE OR ONE SPACE FORWARD AND DIAGONALLY TO"
|
154
|
+
2040 PRINT "CAPTURE AN OPPOSING MAN. ON THE BOARD, YOUR PAWNS"
|
155
|
+
2050 PRINT "ARE 'O', THE COMPUTER'S PAWNS ARE 'X', AND EMPTY "
|
156
|
+
2060 PRINT "SQUARES ARE '.'. TO ENTER A MOVE, TYPE THE NUMBER OF"
|
157
|
+
2070 PRINT "THE SQUARE YOU ARE MOVING FROM, FOLLOWED BY THE NUMBER"
|
158
|
+
2080 PRINT "OF THE SQUARE YOU WILL MOVE TO. THE NUMBERS MUST BE"
|
159
|
+
2090 PRINT "SEPERATED BY A COMMA.": PRINT
|
160
|
+
2100 PRINT "THE COMPUTER STARTS A SERIES OF GAMES KNOWING ONLY WHEN"
|
161
|
+
2105 PRINT "THE GAME IS WON (A DRAW IS IMPOSSIBLE) AND HOW TO MOVE."
|
162
|
+
2110 PRINT "IT HAS NO STRATEGY AT FIRST AND JUST MOVES RANDOMLY."
|
163
|
+
2120 PRINT "HOWEVER, IT LEARNS FROM EACH GAME. THUS, WINNING BECOMES"
|
164
|
+
2130 PRINT "MORE AND MORE DIFFICULT. ALSO, TO HELP OFFSET YOUR"
|
165
|
+
2140 PRINT "INITIAL ADVANTAGE, YOU WILL NOT BE TOLD HOW TO WIN THE"
|
166
|
+
2150 PRINT "GAME BUT MUST LEARN THIS BY PLAYING."
|
167
|
+
2160 PRINT: PRINT "THE NUMBERING OF THE BOARD IS AS FOLLOWS:"
|
168
|
+
2170 PRINT TAB(10);"123": PRINT TAB(10);"456": PRINT TAB(10);"789"
|
169
|
+
2180 PRINT: PRINT "FOR EXAMPLE, TO MOVE YOUR RIGHTMOST PAWN FORWARD,"
|
170
|
+
2190 PRINT "YOU WOULD TYPE 9,6 IN RESPONSE TO THE QUESTION"
|
171
|
+
2200 PRINT "'YOUR MOVE ?'. SINCE I'M A GOOD SPORT, YOU'LL ALWAYS"
|
172
|
+
2210 PRINT "GO FIRST.": PRINT
|
173
|
+
2220 GOTO 100
|
174
|
+
9999 END
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Y
|
2
|
+
7,4
|
3
|
+
8,5
|
4
|
+
4,1
|
5
|
+
7,4
|
6
|
+
4,2
|
7
|
+
7,4
|
8
|
+
9,6
|
9
|
+
7,4
|
10
|
+
8,4
|
11
|
+
7,4
|
12
|
+
8,5
|
13
|
+
9,6
|
14
|
+
8,6
|
15
|
+
9,6
|
16
|
+
7,4
|
17
|
+
8,5
|
18
|
+
7,5
|
19
|
+
9,5
|
20
|
+
8,5
|
21
|
+
5,1
|
22
|
+
8,5
|
23
|
+
5,3
|
24
|
+
8,5
|
25
|
+
5,3
|
26
|
+
7,5
|
27
|
+
8,5
|
28
|
+
9,5
|
29
|
+
7,5
|
30
|
+
8,5
|
31
|
+
9,5
|
32
|
+
7,4
|
33
|
+
4,1
|
34
|
+
5,1
|
35
|
+
5,2
|
36
|
+
8,5
|
37
|
+
9,5
|
38
|
+
7,4
|