mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-12 15:50:20 -08:00
Merge branch 'JoeStrout:main' into main
This commit is contained in:
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript aceyducey.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "aceyducey"
|
||||
run
|
||||
```
|
||||
@@ -7,12 +7,15 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript amazing.ms
|
||||
|
||||
```
|
||||
Note that because this program imports "listUtil", you will need to have a the standard MiniScript libraries somewhere in your import path.
|
||||
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "amazing"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript animal.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "animal"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript awari.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "awari"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bagels.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bagels"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript banner.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "banner"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript basketball.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "basketball"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript batnum.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "batnum"
|
||||
run
|
||||
```
|
||||
@@ -9,10 +9,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript battle.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "battle"
|
||||
run
|
||||
```
|
||||
@@ -7,12 +7,15 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript blackjack.ms
|
||||
|
||||
```
|
||||
But note that the current release (1.2.1) of command-line MiniScript does not properly flush the output buffer when line breaks are suppressed, as this program does when prompting for your next action after a Hit. So, method 2 (below) is recommended for now.
|
||||
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "blackjack"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bombardment.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bombardment"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bombsaway.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bombsaway"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bounce.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bounce"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bowling.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bowling"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript boxing.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "boxing"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bug.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bug"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bull.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bull"
|
||||
run
|
||||
```
|
||||
@@ -10,10 +10,13 @@ Go to https://miniscript.org/tryit/, clear the sample code from the code editor,
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bullseye.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bullseye"
|
||||
run
|
||||
```
|
||||
@@ -10,10 +10,13 @@ Go to https://miniscript.org/tryit/, clear the sample code from the code editor,
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bunny.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bunny"
|
||||
run
|
||||
```
|
||||
@@ -10,10 +10,13 @@ Go to https://miniscript.org/tryit/, clear the sample code from the code editor,
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript bunny.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "bunny"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript calendar.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "calendar"
|
||||
run
|
||||
```
|
||||
@@ -10,10 +10,13 @@ Go to https://miniscript.org/tryit/, clear the sample code from the code editor,
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript change.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "change"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript checkers.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "checkers"
|
||||
run
|
||||
```
|
||||
@@ -10,10 +10,13 @@ Go to https://miniscript.org/tryit/, clear the sample code from the code editor,
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript chemist.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "chemist"
|
||||
run
|
||||
```
|
||||
@@ -12,10 +12,13 @@ Go to https://miniscript.org/tryit/, clear the sample code from the code editor,
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript chief.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "chief"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript chomp.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "chomp"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript civilwar.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "civilwar"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript combat.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "combat"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript craps.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "craps"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript cube.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "cube"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript depthcharge.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "depthcharge.ms"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript diamond.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "diamond"
|
||||
run
|
||||
```
|
||||
@@ -7,13 +7,15 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript dice.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "dice"
|
||||
run
|
||||
|
||||
```
|
||||
3. "Try-It!" page on the web:
|
||||
Go to https://miniscript.org/tryit/, clear the default program from the source code editor, paste in the contents of dice.ms, and click the "Run Script" button.
|
||||
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript digits.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "digits"
|
||||
run
|
||||
```
|
||||
@@ -9,20 +9,25 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript evenwins.ms
|
||||
|
||||
```
|
||||
or
|
||||
|
||||
```
|
||||
miniscript gameofevenwins.ms
|
||||
|
||||
```
|
||||
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "evenwins"
|
||||
run
|
||||
|
||||
```
|
||||
or
|
||||
|
||||
```
|
||||
load "gameofevenwins"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript flipflop.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "flipflop"
|
||||
run
|
||||
```
|
||||
@@ -7,19 +7,23 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript football.ms
|
||||
or
|
||||
```or
|
||||
```
|
||||
miniscript ftball.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "football"
|
||||
run
|
||||
or
|
||||
```or
|
||||
```
|
||||
load "ftball"
|
||||
run
|
||||
|
||||
```
|
||||
|
||||
#### Apology from the Translator
|
||||
|
||||
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript furtrader.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "furtrader"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript golf.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "golf"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript gomoko.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "gomoko"
|
||||
run
|
||||
```
|
||||
@@ -7,13 +7,15 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript guess.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "guess"
|
||||
run
|
||||
|
||||
```
|
||||
3. "Try-It!" page on the web:
|
||||
Go to https://miniscript.org/tryit/, clear the default program from the source code editor, paste in the contents of guess.ms, and click the "Run Script" button.
|
||||
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript gunner.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "gunner"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript hammurabi.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "hammurabi"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript hangman.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "hangman"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript hello.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "hello"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript hexapawn.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "hexapawn"
|
||||
run
|
||||
```
|
||||
@@ -10,10 +10,13 @@ Go to https://miniscript.org/tryit/, clear the sample code from the code editor,
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript hi-lo.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "hi-lo"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript highiq.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "highiq"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript hockey.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "hockey"
|
||||
run
|
||||
```
|
||||
25
00_Alternate_Languages/50_Horserace/MiniScript/README.md
Normal file
25
00_Alternate_Languages/50_Horserace/MiniScript/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
|
||||
|
||||
Conversion to [MiniScript](https://miniscript.org).
|
||||
|
||||
Ways to play:
|
||||
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript horserace.ms
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "horserace"
|
||||
run
|
||||
```
|
||||
|
||||
## Porting Notes
|
||||
|
||||
- The original program, designed to be played directly on a printer, drew a track 27 rows long. To fit better on modern screens, I've shortened the track to 23 rows. This is adjustable via the "trackLen" value assigned on line 72.
|
||||
|
||||
- Also because we're playing on a screen instead of a printer, I'm clearing the screen and pausing briefly before each new update of the track. This is done via the `clear` API when running in Mini Micro, or by using a VT100 escape sequence in other contexts.
|
||||
149
00_Alternate_Languages/50_Horserace/MiniScript/horserace.ms
Normal file
149
00_Alternate_Languages/50_Horserace/MiniScript/horserace.ms
Normal file
@@ -0,0 +1,149 @@
|
||||
print " "*31 + "Horserace"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
|
||||
print "Welcome to South Portland High Racetrack"
|
||||
print " ...owned by Laurie Chevalier"
|
||||
|
||||
// show directions, if wanted
|
||||
x = input("Do you want directions? ").lower
|
||||
if not x or x[0] != "n" then
|
||||
print "Up to 10 may play. A table of odds will be printed. You"
|
||||
print "may bet any + amount under 100000 on one horse."
|
||||
print "During the race, a horse will be shown by its"
|
||||
print "number. The horses race down the paper!"
|
||||
print
|
||||
end if
|
||||
|
||||
// get player names
|
||||
qtyPlayers = input("How many want to bet? ").val
|
||||
if qtyPlayers < 1 then exit
|
||||
print "When ? appears, type name"
|
||||
playerNames = [null]
|
||||
for i in range(1, qtyPlayers)
|
||||
playerNames.push input("?")
|
||||
end for
|
||||
print
|
||||
pick = [null] + [0]*qtyPlayers
|
||||
bet = [null] + [0]*qtyPlayers
|
||||
|
||||
d = [0] * 9 // odds denominator
|
||||
r = 0 // odds numerator
|
||||
|
||||
printInColumns = function(col0, col1, col2)
|
||||
print (col0+" "*16)[16] + (col1+" "*10)[:10] + (col2+" "*10)[:10]
|
||||
end function
|
||||
|
||||
setup = function
|
||||
// initialize the horses
|
||||
globals.names = [null] +
|
||||
"Joe Maw,L.B.J.,Mr.Washburn,Miss Karen,Jolly,Horse,Jelly Do Not,Midnight".split(",")
|
||||
for i in range(1,8)
|
||||
d[i] = floor(10*rnd+1)
|
||||
end for
|
||||
globals.r = d.sum
|
||||
|
||||
// print odds table
|
||||
printInColumns "Horse", "Number", "Odds"
|
||||
for i in range(1,8)
|
||||
printInColumns names[i], i, round(r/d[i],2) + ":1"
|
||||
end for
|
||||
|
||||
// get the players' bets
|
||||
print "--------------------------------------------------"
|
||||
print "Place your bets...Horse # then Amount"
|
||||
for j in range(1, qtyPlayers)
|
||||
while true
|
||||
s = input(playerNames[j] + "? ").replace(",", " ").split
|
||||
if s.len < 2 then s.push -1
|
||||
pick[j] = s[0].val
|
||||
bet[j] = s[-1].val
|
||||
if pick[j] < 1 or pick[j] > 8 or bet[j] < 1 or bet[j] >=100000 then
|
||||
print "You can't do that!"
|
||||
else
|
||||
break
|
||||
end if
|
||||
end while
|
||||
end for
|
||||
end function
|
||||
|
||||
// Draw a racetrack, with each horse the given number
|
||||
// of lines down from START to FINISH.
|
||||
trackLen = 23
|
||||
drawTrack = function(horsePositions)
|
||||
print
|
||||
if version.hostName == "Mini Micro" then clear else print char(27)+"c"
|
||||
if horsePositions[1] == 0 then print "1 2 3 4 5 6 7 8" else print
|
||||
print "XXXXSTARTXXXX"
|
||||
for row in range(1, trackLen)
|
||||
for h in range(1,8)
|
||||
p = horsePositions[h]
|
||||
if p > trackLen then p = trackLen
|
||||
if p == row then print h, " "
|
||||
end for
|
||||
print
|
||||
end for
|
||||
print "XXXXFINISHXXXX", ""
|
||||
if version.hostName != "Mini Micro" then print
|
||||
end function
|
||||
|
||||
runRace = function
|
||||
pos = [0]*9
|
||||
maxPos = 0
|
||||
while true
|
||||
drawTrack pos
|
||||
wait 1
|
||||
if maxPos >= trackLen then break
|
||||
for i in range(1,8)
|
||||
q = floor(100*rnd+1)
|
||||
x = floor(r/d[i]+0.5)
|
||||
if q < 10 then
|
||||
speed = 1
|
||||
else if q < x+17 then
|
||||
speed = 2
|
||||
else if q < x+37 then
|
||||
speed = 3
|
||||
else if q < x+57 then
|
||||
speed = 4
|
||||
else if q < x+77 then
|
||||
speed = 5
|
||||
else if q < x+92 then
|
||||
speed = 6
|
||||
else
|
||||
speed = 7
|
||||
end if
|
||||
pos[i] += speed
|
||||
if pos[i] > maxPos then maxPos = pos[i]
|
||||
end for
|
||||
end while
|
||||
|
||||
print
|
||||
print "---------------------------------------------"
|
||||
print
|
||||
print "The race results are:"
|
||||
results = []
|
||||
for i in range(1,8)
|
||||
results.push {"num":i, "pos":pos[i]}
|
||||
end for
|
||||
results.sort "pos", false
|
||||
for place in range(1, 8)
|
||||
h = results[place-1].num
|
||||
print " " + place + " Place Horse No. " + h + " at " + round(r/d[h],2) + ":1"
|
||||
print
|
||||
end for
|
||||
for p in range(1, qtyPlayers)
|
||||
if pick[p] == results[0].num then
|
||||
print playerNames[p] + " wins $" + round((r/d[pick[p]])*bet[p], 2)
|
||||
end if
|
||||
end for
|
||||
end function
|
||||
|
||||
// Main loop
|
||||
while true
|
||||
setup
|
||||
runRace
|
||||
print "Do you want to bet on the next race ?"
|
||||
yn = input("Yes or no? ").lower
|
||||
if not yn or yn[0] != "y" then break
|
||||
end while
|
||||
|
||||
22
00_Alternate_Languages/51_Hurkle/MiniScript/README.md
Normal file
22
00_Alternate_Languages/51_Hurkle/MiniScript/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
|
||||
|
||||
Conversion to [MiniScript](https://miniscript.org).
|
||||
|
||||
Ways to play:
|
||||
|
||||
0. Try-It! Page:
|
||||
Go to https://miniscript.org/tryit/, clear the sample code from the code editor, and paste in the contents of hurkle.ms. Then click the "Run Script" button. Program output (and input) will appear in the green-on-black terminal display to the right of or below the code editor.
|
||||
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript hurkle.ms
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "hurkle"
|
||||
run
|
||||
```
|
||||
56
00_Alternate_Languages/51_Hurkle/MiniScript/hurkle.ms
Normal file
56
00_Alternate_Languages/51_Hurkle/MiniScript/hurkle.ms
Normal file
@@ -0,0 +1,56 @@
|
||||
print " "*33 + "Hurcle"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
n = 5 // number of guesses allowed
|
||||
g = 10 // grid size
|
||||
print
|
||||
print "A hurkle is hiding on a " + g + " by " + g + " grid. Homebase"
|
||||
print "on the grid is point 0,0 in the southwest corner,"
|
||||
print "and any point on the grid is designated by a"
|
||||
print "pair of whole numbers seperated by a comma. The first"
|
||||
print "number is the horizontal position and the second number"
|
||||
print "is the vertical position. You must try to"
|
||||
print "guess the hurkle's gridpoint. You get " + n + "tries."
|
||||
print "After each try, I will tell you the approximate"
|
||||
print "direction to go to look for the hurkle."
|
||||
print
|
||||
|
||||
playOneGame = function
|
||||
a = floor(g*rnd)
|
||||
b = floor(g*rnd)
|
||||
for k in range(1, n)
|
||||
s = input("Guess #" + k + "? ").replace(",", " ").split
|
||||
x = s[0].val
|
||||
y = s[-1].val
|
||||
if x == a and y == b then
|
||||
print
|
||||
print "You found him in " + k + " guesses!"
|
||||
return
|
||||
end if
|
||||
if y == b then
|
||||
if x == a then
|
||||
print
|
||||
print "You found him in " + k + " guesses!"
|
||||
return
|
||||
else if x < a then
|
||||
dir = "east"
|
||||
else
|
||||
dir = "west"
|
||||
end if
|
||||
else if y < b then
|
||||
dir = "north"
|
||||
else
|
||||
dir = "south"
|
||||
end if
|
||||
print "Go " + dir
|
||||
end for
|
||||
print "Sorry, that's " + n + " guesses."
|
||||
print "The hurkle is at " + a + "," + b
|
||||
end function
|
||||
|
||||
while true
|
||||
playOneGame
|
||||
print
|
||||
print "Let's play again, hurkle is hiding."
|
||||
print
|
||||
end while
|
||||
@@ -7,13 +7,15 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript kinema.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "kinema"
|
||||
run
|
||||
|
||||
```
|
||||
3. "Try-It!" page on the web:
|
||||
Go to https://miniscript.org/tryit/, clear the default program from the source code editor, paste in the contents of kinema.ms, and click the "Run Script" button.
|
||||
|
||||
19
00_Alternate_Languages/53_King/MiniScript/README.md
Normal file
19
00_Alternate_Languages/53_King/MiniScript/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
|
||||
|
||||
Conversion to [MiniScript](https://miniscript.org).
|
||||
|
||||
Ways to play:
|
||||
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript king.ms
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "king"
|
||||
run
|
||||
```
|
||||
403
00_Alternate_Languages/53_King/MiniScript/king.ms
Normal file
403
00_Alternate_Languages/53_King/MiniScript/king.ms
Normal file
@@ -0,0 +1,403 @@
|
||||
print " "*34 + "KING"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
|
||||
yearsRequired = 8
|
||||
rallods = floor(60000+(1000*rnd)-(1000*rnd))
|
||||
countrymen = floor(500+(10*rnd)-(10*rnd))
|
||||
landArea = 2000
|
||||
foreignWorkers = 0
|
||||
sellableLandExplained = false
|
||||
tourism = 0
|
||||
year = 0
|
||||
|
||||
zs = input("Do you want instructions? ").lower
|
||||
if zs == "again" then
|
||||
while true
|
||||
year = input("How many years had you been in office when interrupted? ").val
|
||||
if 0 <= year < yearsRequired then break
|
||||
print " Come on, your term in office is only " + yearsRequired + " years."
|
||||
end while
|
||||
rallods = input("How much did you have in the treasury? ").val
|
||||
countrymen = input("How many countrymen? ").val
|
||||
foreignWorkers = input("How many foreign workers? ").val
|
||||
while true
|
||||
landArea = input("How many square miles of land? ").val
|
||||
if 1000 <= landArea <= 2000 then break
|
||||
print " Come on, you started with 1000 sq. miles of farm land"
|
||||
print " and 1000 sq. miles of forest land."
|
||||
end while
|
||||
else if not zs or zs[0] != "n" then
|
||||
print; print; print
|
||||
print "Congratulations! You've just been elected premier of Setats"
|
||||
print "Detinu, a small communist island 30 by 70 miles long. Your"
|
||||
print "job is to decide upon the contry's budget and distribute"
|
||||
print "money to your countrymen from the communal treasury."
|
||||
print "The money system is rallods, and each person needs 100"
|
||||
print "rallods per year to survive. Your country's income comes"
|
||||
print "from farm produce and tourists visiting your magnificent"
|
||||
print "forests, hunting, fishing, etc. Half your land is farm land"
|
||||
print "which also has an excellent mineral content and may be sold"
|
||||
print "to foreign industry (strip mining) who import and support"
|
||||
print "their own workers. Crops cost between 10 and 15 rallods per"
|
||||
print "square mile to plant."
|
||||
print "Your goal is to complete your " + yearsRequired + " year term of office."
|
||||
print "Good luck!"
|
||||
end if
|
||||
|
||||
print
|
||||
|
||||
|
||||
// Bonus little feature when running in Mini Micro: display a status bar with
|
||||
// key game stats at the top of the screen.
|
||||
updateStatusBar = function
|
||||
if version.hostName != "Mini Micro" then return
|
||||
display(2).mode = displayMode.text; td = display(2)
|
||||
s = " Rallods: " + (rallods + " "*8)[:8]
|
||||
s += " Land: " + (landArea + " "*6)[:6]
|
||||
s += " Countrymen: " + (countrymen + " "*6)[:6]
|
||||
s += " Foreigners: " + (foreignWorkers + " "*5)[:5]
|
||||
td.color = color.black; td.backColor = text.color
|
||||
td.row = 25; td.column = 0; td.print s
|
||||
end function
|
||||
|
||||
min0 = function(x)
|
||||
if x < 0 then return 0 else return x
|
||||
end function
|
||||
floorMin0 = function(x)
|
||||
return min0(floor(x))
|
||||
end function
|
||||
stop = function
|
||||
updateStatusBar
|
||||
print; print; exit
|
||||
end function
|
||||
|
||||
while true
|
||||
landPrice = floor(10*rnd+95)
|
||||
plantingArea = 0
|
||||
pollutionControl = 0
|
||||
deaths = 0
|
||||
|
||||
print
|
||||
print "You now have " + rallods + " rallods in the treasury."
|
||||
print floor(countrymen) + " countrymen, ", ""
|
||||
costToPlant = floor(((rnd/2)*10+10))
|
||||
if foreignWorkers != 0 then
|
||||
print floor(foreignWorkers) + " foreign workers, ", ""
|
||||
end if
|
||||
print "and " + floor(landArea) + " sq. miles of land."
|
||||
print "This year industry will buy land for " + landPrice, ""
|
||||
print " rallods per square mile."
|
||||
print "Land currently costs " + costToPlant + " rallods per square mile to plant."
|
||||
print
|
||||
|
||||
updateStatusBar
|
||||
while true
|
||||
sellToIndustry = input("How many square miles do you wish to sell to industry? ").val
|
||||
if sellToIndustry < 0 then continue
|
||||
if sellToIndustry <= landArea-1000 then break
|
||||
print "*** Think again. You only have " + (landArea-1000) + " square miles of farm land."
|
||||
if not sellableLandExplained then
|
||||
print;print "(Foreign industry will only buy farm land because"
|
||||
print "forest land is uneconomical to strip mine due to trees,"
|
||||
print "thicker top soil, etc.)"
|
||||
sellableLandExplained = true
|
||||
end if
|
||||
end while
|
||||
landArea = floor(landArea-sellToIndustry)
|
||||
rallods = floor(rallods+(sellToIndustry*landPrice))
|
||||
|
||||
updateStatusBar
|
||||
while true
|
||||
welfare = input("How many rallods will you distribute among your countrymen? ").val
|
||||
if welfare < 0 then continue
|
||||
if welfare <= rallods then break
|
||||
print " Think again. You've only " + rallods + " rallods in the treasury"
|
||||
end while
|
||||
rallods = floor(rallods-welfare)
|
||||
|
||||
updateStatusBar
|
||||
while rallods > 0
|
||||
plantingArea = input("How many square miles do you wish to plant? ").val
|
||||
if plantingArea < 0 then continue
|
||||
if plantingArea > countrymen*2 then
|
||||
print " Sorry, but each countryman can only plant 2 sq. miles."
|
||||
continue
|
||||
end if
|
||||
if plantingArea > landArea-1000 then
|
||||
print " Sorry, but you've only " + (landArea-1000) + " sq. miles of farm land."
|
||||
continue
|
||||
end if
|
||||
plantingCost = floor(plantingArea * costToPlant)
|
||||
if plantingCost <= rallods then break
|
||||
print " Think again. You've only " + rallods + " rallods left in the treasury."
|
||||
end while
|
||||
rallods -= plantingCost
|
||||
|
||||
updateStatusBar
|
||||
while rallods > 0
|
||||
pollutionControl = input("How many rallods do you wish to spend on pollution control? ").val
|
||||
if pollutionControl < 0 then continue
|
||||
if pollutionControl <= rallods then break
|
||||
print " Think again. You only have " + rallods + " rallods remaining."
|
||||
end while
|
||||
|
||||
if sellToIndustry == 0 and welfare == 0 and plantingArea == 0 and pollutionControl == 0 then
|
||||
print
|
||||
print "Goodbye."
|
||||
print "(If you wish to continue this game at a later date, answer"
|
||||
print "'again' when asked if you want instructions at the start"
|
||||
print "of the game.)"
|
||||
exit
|
||||
end if
|
||||
|
||||
print
|
||||
print
|
||||
|
||||
rallods = floor(rallods-pollutionControl)
|
||||
updateStatusBar
|
||||
|
||||
original_rallods = rallods
|
||||
|
||||
starvationDeaths = floorMin0(countrymen - welfare/100)
|
||||
if starvationDeaths then
|
||||
if welfare/100 < 50 then
|
||||
print
|
||||
print
|
||||
print "Over one third of the popultation has died since you"
|
||||
print "were elected to office. The people (remaining)"
|
||||
print "hate your guts."
|
||||
if rnd > .5 then
|
||||
print "You have been thrown out of office and are now"
|
||||
print "residing in prison."
|
||||
else
|
||||
print "You have been assassinated."
|
||||
end if
|
||||
countrymen -= starvationDeaths
|
||||
stop
|
||||
end if
|
||||
print starvationDeaths + " countrymen died of starvation"
|
||||
end if
|
||||
|
||||
pollutionDeaths = floorMin0(rnd*(2000-landArea))
|
||||
if pollutionControl >= 25 then
|
||||
pollutionDeaths = floor(pollutionDeaths/(pollutionControl/25))
|
||||
end if
|
||||
if pollutionDeaths > 0 then
|
||||
print pollutionDeaths + " countrymen died of carbon-monoxide and dust inhalation"
|
||||
end if
|
||||
|
||||
deaths = starvationDeaths + pollutionDeaths
|
||||
if deaths then
|
||||
print " You were forced to spend " + floor(deaths*9), ""
|
||||
print " rallods on funeral expenses"
|
||||
rallods -= deaths * 9
|
||||
end if
|
||||
|
||||
if rallods < 0 then
|
||||
print " Insufficient reserves to cover cost - land was sold"
|
||||
landArea = floorMin0(landArea+(rallods/landPrice))
|
||||
rallods = 0
|
||||
end if
|
||||
|
||||
countrymen = min0(countrymen - deaths)
|
||||
|
||||
if sellToIndustry then
|
||||
newForeigners = floor(sellToIndustry+(rnd*10)-(rnd*20))
|
||||
if foreignWorkers == 0 then newForeigners += 20
|
||||
foreignWorkers += newForeigners
|
||||
print newForeigners + " workers came to the country and ", ""
|
||||
end if
|
||||
|
||||
immigration = floor(((welfare/100-countrymen)/10)+(pollutionControl/25)-((2000-landArea)/50)-(pollutionDeaths/2))
|
||||
print abs(immigration) + " countrymen ", ""
|
||||
if immigration < 0 then print "came to", "" else print "left", ""
|
||||
print " the island."
|
||||
countrymen = floorMin0(countrymen + immigration)
|
||||
|
||||
cropLoss = floor(((2000-landArea)*((rnd+1.5)/2)))
|
||||
if cropLoss > plantingArea then cropLoss = plantingArea
|
||||
if foreignWorkers > 0 then print "Of " + floor(plantingArea) + " sq. miles planted,", ""
|
||||
print " you harvested " + floor(plantingArea-cropLoss) + " sq. miles of crops."
|
||||
if cropLoss then
|
||||
print " (Due to air and water pollution from foreign industry.)"
|
||||
end if
|
||||
agriculturalIncome = floor((plantingArea-cropLoss)*(landPrice/2))
|
||||
print "Making " + agriculturalIncome + " rallods."
|
||||
rallods += agriculturalIncome
|
||||
|
||||
v1 = floor(((countrymen-immigration)*22)+(rnd*500))
|
||||
v2 = floor((2000-landArea)*15)
|
||||
prevTourism = tourism
|
||||
tourism = abs(floor(v1-v2))
|
||||
print " You made " + tourism + " rallods from tourist trade."
|
||||
if v2 > 2 and tourism < prevTourism then
|
||||
print " Decrease because ", ""
|
||||
g1 = 10*rnd
|
||||
if g1 <= 2 then
|
||||
print "fish population has dwindled due to water pollution."
|
||||
else if g1 <= 4 then
|
||||
print "air pollution is killing game bird population."
|
||||
else if g1 <= 6 then
|
||||
print "mineral baths are being ruined by water pollution."
|
||||
else if g1 <= 8 then
|
||||
print "unpleasant smog is discouraging sun bathers."
|
||||
else
|
||||
print "hotels are looking shabby due to smog grit."
|
||||
end if
|
||||
end if
|
||||
rallods += tourism
|
||||
updateStatusBar
|
||||
|
||||
if deaths > 200 then
|
||||
print
|
||||
print
|
||||
print deaths + "countrymen died in one year!!!!!"
|
||||
print "due to this extreme mismanagement, you have not only"
|
||||
print "been impeached and thrown out of office, but you"
|
||||
m6 = floor(rnd*10)
|
||||
if m6 <= 3 then 1670
|
||||
if m6 <= 6 then 1680
|
||||
if m6 <= 10 then 1690
|
||||
print "also had your left eye gouged out!"
|
||||
goto 1590
|
||||
print "have also gained a very bad reputation."
|
||||
goto 1590
|
||||
print "have also been declared national fink."
|
||||
stop
|
||||
else if countrymen < 343 then
|
||||
print
|
||||
print
|
||||
print "Over one third of the popultation has died since you"
|
||||
print "were elected to office. The people (remaining)"
|
||||
print "hate your guts."
|
||||
if rnd > .5 then
|
||||
print "You have been thrown out of office and are now"
|
||||
print "residing in prison."
|
||||
else
|
||||
print "You have been assassinated."
|
||||
end if
|
||||
stop
|
||||
else if (original_rallods/100) > 5 and deaths - pollutionDeaths >= 2 then
|
||||
print
|
||||
print "Money was left over in the treasury which you did"
|
||||
print "not spend. As a result, some of your countrymen died"
|
||||
print "of starvation. The public is enraged and you have"
|
||||
print "been forced to either resign or commit suicide."
|
||||
print "The choice is yours."
|
||||
print "If you choose the latter, please turn off your computer"
|
||||
print "before proceeding."
|
||||
stop
|
||||
else if foreignWorkers > countrymen then
|
||||
print
|
||||
print
|
||||
print "The number of foreign workers has exceeded the number"
|
||||
print "of countrymen. As a minority, they have revolted and"
|
||||
print "taken over the country."
|
||||
if rnd > .5 then
|
||||
print "You have been thrown out of office and are now"
|
||||
print "residing in prison."
|
||||
else
|
||||
print "You have been assassinated."
|
||||
end if
|
||||
stop
|
||||
else if year == yearsRequired-1 then
|
||||
print
|
||||
print
|
||||
print "Congratulations!!!!!!!!!!!!!!!!!!"
|
||||
print "You have succesfully completed your " + yearsRequired + " year term"
|
||||
print "of office. You were, of course, extremely lucky, but"
|
||||
print "nevertheless, it's quite an achievement. Goodbye and good"
|
||||
print "luck - you'll probably need it if you're the type that"
|
||||
print "plays this game."
|
||||
stop
|
||||
end if
|
||||
|
||||
updateStatusBar
|
||||
wait
|
||||
year += 1
|
||||
end while
|
||||
|
||||
//print
|
||||
//print
|
||||
//print "the number of foreign workers has exceeded the number"
|
||||
//print "of countrymen. as a minority, they have revolted and"
|
||||
//print "taken over the country."
|
||||
//if rnd<=.5 then 1580
|
||||
//print "you have been thrown out of office and are now"
|
||||
//print "residing in prison."
|
||||
//goto 1590
|
||||
//print "you have been assassinated."
|
||||
//print
|
||||
//print
|
||||
//exit
|
||||
//print
|
||||
//print
|
||||
//print deaths + "countrymen died in one year!!!!!"
|
||||
//print "due to this extreme mismanagement, you have not only"
|
||||
//print "been impeached and thrown out of office, but you"
|
||||
//m6 = floor(rnd*10)
|
||||
//if m6 <= 3 then 1670
|
||||
//if m6 <= 6 then 1680
|
||||
//if m6 <= 10 then 1690
|
||||
//print "also had your left eye gouged out!"
|
||||
//goto 1590
|
||||
//print "have also gained a very bad reputation."
|
||||
//goto 1590
|
||||
//print "have also been declared national fink."
|
||||
//goto 1590
|
||||
//
|
||||
//print
|
||||
//print
|
||||
//print "over one third of the popultation has died since you"
|
||||
//print "were elected to office. the people (remaining)"
|
||||
//print "hate your guts."
|
||||
//goto 1570
|
||||
//if deaths-pollutionDeaths < 2 then 1515
|
||||
//print
|
||||
//print "money was left over in the treasury which you did"
|
||||
//print "not spend. as a result, some of your countrymen died"
|
||||
//print "of starvation. the public is enraged and you have"
|
||||
//print "been forced to either resign or commit suicide."
|
||||
//print "the choice is yours."
|
||||
//print "if you choose the latter, please turn off your computer"
|
||||
//print "before proceeding."
|
||||
//goto 1590
|
||||
//print
|
||||
//print
|
||||
//print "congratulations!!!!!!!!!!!!!!!!!!"
|
||||
//print "you have succesfully completed your" + yearsRequired + "year term"
|
||||
//print "of office. you were, of course, extremely lucky, but"
|
||||
//print "nevertheless, it's quite an achievement. goodbye and good"
|
||||
//print "luck - you'll probably need it if you're the type that"
|
||||
//print "plays this game."
|
||||
//goto 1590
|
||||
//
|
||||
//print "how many years had you been in office when interrupted";
|
||||
//input year
|
||||
//if year < 0 then 1590
|
||||
//if year < 8 then 1969
|
||||
//print " come on, your term in office is only" + yearsRequired + "years."
|
||||
//goto 1960
|
||||
//print "how much did you have in the treasury";
|
||||
//input rallods
|
||||
//if rallods < 0 then 1590
|
||||
//print "how many countrymen";
|
||||
//input countrymen
|
||||
//if countrymen < 0 then 1590
|
||||
//print "how many workers";
|
||||
//input foreignWorkers
|
||||
//if foreignWorkers < 0 then 1590
|
||||
//print "how many square miles of land";
|
||||
//input landArea
|
||||
//if landArea < 0 then 1590
|
||||
//if landArea > 2000 then 1996
|
||||
//if landArea > 1000 then 100
|
||||
//print " come on, you started with 1000 sq. miles of farm land"
|
||||
//print " and 10,000 sq. miles of forest land."
|
||||
//goto 1990
|
||||
//
|
||||
//year = year+1
|
||||
//deaths = 0
|
||||
//goto 100
|
||||
//end
|
||||
@@ -8,7 +8,7 @@
|
||||
11 IF Z$="AGAIN" THEN 1960
|
||||
12 PRINT:PRINT:PRINT
|
||||
20 PRINT "CONGRATULATIONS! YOU'VE JUST BEEN ELECTED PREMIER OF SETATS"
|
||||
22 PRINT "DETINU, RALLODS SMALL COMMUNIST ISLAND 30 BY 70 MILES LONG. YOUR"
|
||||
22 PRINT "DETINU, A SMALL COMMUNIST ISLAND 30 BY 70 MILES LONG. YOUR"
|
||||
24 PRINT "JOB IS TO DECIDE UPON THE CONTRY'S BUDGET AND DISTRIBUTE"
|
||||
26 PRINT "MONEY TO YOUR COUNTRYMEN FROM THE COMMUNAL TREASURY."
|
||||
28 PRINT "THE MONEY SYSTEM IS RALLODS, AND EACH PERSON NEEDS 100"
|
||||
@@ -219,7 +219,7 @@ REM I think tourism calculations are actually wrong in the original code!
|
||||
1505 IF COUNTRYMEN<343 THEN 1700
|
||||
1510 IF (ORIGINAL_RALLODS/100)>5 THEN 1800
|
||||
1515 IF FOREIGN_WORKERS>COUNTRYMEN THEN 1550
|
||||
1520 IF YEARS_REQUIRED-1=X5 THEN 1900
|
||||
1520 IF YEARS_REQUIRED-1=YEAR THEN 1900
|
||||
1545 GOTO 2000
|
||||
1550 PRINT
|
||||
1552 PRINT
|
||||
@@ -277,9 +277,9 @@ REM I think tourism calculations are actually wrong in the original code!
|
||||
1950 GOTO 1590
|
||||
|
||||
1960 PRINT "HOW MANY YEARS HAD YOU BEEN IN OFFICE WHEN INTERRUPTED";
|
||||
1961 INPUT X5
|
||||
1962 IF X5<0 THEN 1590
|
||||
1963 IF X5<8 THEN 1969
|
||||
1961 INPUT YEAR
|
||||
1962 IF YEAR<0 THEN 1590
|
||||
1963 IF YEAR<8 THEN 1969
|
||||
1965 PRINT " COME ON, YOUR TERM IN OFFICE IS ONLY";YEARS_REQUIRED;"YEARS."
|
||||
1967 GOTO 1960
|
||||
1969 PRINT "HOW MUCH DID YOU HAVE IN THE TREASURY";
|
||||
@@ -300,7 +300,7 @@ REM I think tourism calculations are actually wrong in the original code!
|
||||
1997 PRINT " AND 10,000 SQ. MILES OF FOREST LAND."
|
||||
1998 GOTO 1990
|
||||
|
||||
2000 X5=X5+1
|
||||
2000 YEAR=YEAR+1
|
||||
2020 DEATHS=0
|
||||
2040 GOTO 100
|
||||
2046 END
|
||||
|
||||
@@ -7,13 +7,15 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript letter.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "letter"
|
||||
run
|
||||
|
||||
```
|
||||
3. "Try-It!" page on the web:
|
||||
Go to https://miniscript.org/tryit/, clear the default program from the source code editor, paste in the contents of letter.ms, and click the "Run Script" button.
|
||||
|
||||
19
00_Alternate_Languages/55_Life/MiniScript/README.md
Normal file
19
00_Alternate_Languages/55_Life/MiniScript/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
|
||||
|
||||
Conversion to [MiniScript](https://miniscript.org).
|
||||
|
||||
Ways to play:
|
||||
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript life.ms
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "life"
|
||||
run
|
||||
```
|
||||
132
00_Alternate_Languages/55_Life/MiniScript/life.ms
Normal file
132
00_Alternate_Languages/55_Life/MiniScript/life.ms
Normal file
@@ -0,0 +1,132 @@
|
||||
print " "*34 + "LIFE"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
import "listUtil" // (needed for list.init2d)
|
||||
|
||||
maxx = 66 // (size adjusted for Mini Micro display)
|
||||
maxy = 23
|
||||
A = list.init2d(maxx+1, maxy+1, 0)
|
||||
|
||||
// Stuff the given pattern into the center of the cell array.
|
||||
// Return the number of live cells.
|
||||
stuffIntoCenter = function(pattern)
|
||||
maxLen = 0
|
||||
for p in pattern
|
||||
if p.len > maxLen then maxLen = p.len
|
||||
end for
|
||||
|
||||
population = 0
|
||||
y = floor(maxy/2 - pattern.len/2)
|
||||
for row in pattern
|
||||
x = floor(maxx/2 - maxLen/2)
|
||||
for c in row
|
||||
if c != " " then
|
||||
A[x][y] = 1
|
||||
population += 1
|
||||
end if
|
||||
x += 1
|
||||
end for
|
||||
y += 1
|
||||
end for
|
||||
return population
|
||||
end function
|
||||
|
||||
// Get the initial pattern from the user
|
||||
initToUserPattern = function
|
||||
print "Enter your pattern (enter DONE when done):"
|
||||
userPattern = []
|
||||
while true
|
||||
p = input("?")
|
||||
if p.upper == "DONE" then break
|
||||
if p and p[0] == "." then p = " " + p[1:]
|
||||
userPattern.push p
|
||||
end while
|
||||
return stuffIntoCenter(userPattern)
|
||||
end function
|
||||
|
||||
// For testing purposes, skip asking the user and just use a hard-coded pattern.
|
||||
initToStandardPattern = function
|
||||
pattern = [
|
||||
" **",
|
||||
" * *",
|
||||
" *"]
|
||||
return stuffIntoCenter(pattern)
|
||||
end function
|
||||
|
||||
// Or, just for fun, initialize to a random pattern of junk in the center.
|
||||
initRandom = function
|
||||
for x in range(ceil(maxx*0.3), floor(maxx*0.7))
|
||||
for y in range(ceil(maxy*0.3), floor(maxy*0.7))
|
||||
A[x][y] = rnd > 0.5
|
||||
end for
|
||||
end for
|
||||
end function
|
||||
|
||||
// Define a function to draw the current game state.
|
||||
// This also changes 2 (dying) to 0 (dead), and 3 (being born) to 1 (alive).
|
||||
drawGameState = function(generation=0, population=0, invalid=false)
|
||||
if version.hostName == "Mini Micro" then text.row = 26 else print
|
||||
print "Generation: " + generation + " Population: " + population +
|
||||
" " + "INVALID!" * invalid
|
||||
for y in range(0, maxy)
|
||||
s = ""
|
||||
for x in range(0, maxx)
|
||||
if A[x][y] == 2 then
|
||||
A[x][y] = 0
|
||||
else if A[x][y] == 3 then
|
||||
A[x][y] = 1
|
||||
end if
|
||||
if A[x][y] then s += "*" else s += " "
|
||||
end for
|
||||
print s
|
||||
end for
|
||||
end function
|
||||
|
||||
// Update the game state, setting cells that should be born to 3 and
|
||||
// cells that should die to 2. Return the number of cells that will
|
||||
// be alive after this update. Also, set globals.invalid if any live
|
||||
// cells are found on the edge of the map.
|
||||
updateGameState = function
|
||||
population = 0
|
||||
for x in range(0, maxx)
|
||||
for y in range(0, maxy)
|
||||
c = A[x][y] == 1 or A[x][y] == 2 // center state
|
||||
n = -c // number of neighbors
|
||||
for nx in range(x-1, x+1)
|
||||
if nx < 0 or nx > maxx then continue
|
||||
for ny in range(y-1, y+1)
|
||||
if ny < 0 or ny > maxy then continue
|
||||
n += A[nx][ny] == 1 or A[nx][ny] == 2
|
||||
end for
|
||||
end for
|
||||
if c and n != 2 and n != 3 then // live cell with < 2 or > 3 neighbors...
|
||||
A[x][y] = 2 // dies
|
||||
else if not c and n == 3 then // dead cell with 3 neighbors...
|
||||
A[x][y] = 3 // comes to life
|
||||
if x == 0 or x == maxx or y == 0 or y == maxy then
|
||||
globals.invalid = true
|
||||
end if
|
||||
end if
|
||||
population += (A[x][y] == 1 or A[x][y] == 3)
|
||||
end for
|
||||
end for
|
||||
return population
|
||||
end function
|
||||
|
||||
|
||||
// Initialize the game state (uncomment one of the following three lines)
|
||||
population = initToUserPattern
|
||||
//population = initToStandardPattern
|
||||
//population = initRandom
|
||||
|
||||
// Main loop
|
||||
if version.hostName == "Mini Micro" then clear
|
||||
invalid = false
|
||||
generation = 0
|
||||
while population > 0
|
||||
drawGameState generation, population, invalid
|
||||
population = updateGameState
|
||||
generation += 1
|
||||
//key.get // <-- Uncomment this to single-step with each keypress!
|
||||
end while
|
||||
drawGameState generation, population, invalid
|
||||
19
00_Alternate_Languages/56_Life_for_Two/MiniScript/README.md
Normal file
19
00_Alternate_Languages/56_Life_for_Two/MiniScript/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
|
||||
|
||||
Conversion to [MiniScript](https://miniscript.org). The only liberty I took with the original design is that, when prompting each player for their turn, I include a reminder of what symbol (* or #) represents their pieces on the board.
|
||||
|
||||
Ways to play:
|
||||
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript lifefortwo.ms
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "lifefortwo"
|
||||
run
|
||||
```
|
||||
129
00_Alternate_Languages/56_Life_for_Two/MiniScript/lifefortwo.ms
Normal file
129
00_Alternate_Languages/56_Life_for_Two/MiniScript/lifefortwo.ms
Normal file
@@ -0,0 +1,129 @@
|
||||
print " "*33 + "LIFE2"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
print " "*10 + "U.B. LIFE GAME"
|
||||
|
||||
// N: counts neighbors and game state, as follows:
|
||||
// 1's digit: player 1 neighbors
|
||||
// 10's digit: player 2 neighbors
|
||||
// 100's digit: player 1 current live cell
|
||||
// 1000's digit: player 2 current live cell
|
||||
N = []
|
||||
for i in range(0,6); N.push [0]*7; end for
|
||||
|
||||
// K: encodes the rule for what cells come to life, based on
|
||||
// the value in N. The first 9 entries mean new life for Player 1;
|
||||
// the second 9 entries mean new life for Player 2.
|
||||
K = [3,102,103,120,130,121,112,111,12,
|
||||
21,30,1020,1030,1011,1021,1003,1002,1012]
|
||||
|
||||
// population: how many live cells each player (1-2) has
|
||||
population = [null, 0, 0]
|
||||
|
||||
// Function to get input coordinates from the player, for any empty space.
|
||||
// Where possible, hide the input so the other player can't see it.
|
||||
getCoords = function
|
||||
while true
|
||||
print "X,Y"
|
||||
inp = input.replace(",", " ").replace(" "," ")
|
||||
if version.hostName == "Mini Micro" then
|
||||
text.row = text.row + 1; print " "*60
|
||||
end if
|
||||
parts = inp.split
|
||||
if parts.len == 2 then
|
||||
x = parts[0].val
|
||||
y = parts[1].val
|
||||
if 0 < x <= 5 and 0 < y <= 5 and N[x][y] == 0 then break
|
||||
end if
|
||||
print "Illegal coords. Retype"
|
||||
end while
|
||||
return [x, y]
|
||||
end function
|
||||
|
||||
// Function to print the board. At the same time, it replaces
|
||||
// any player 1 value (as judged by list K) with 100, and any
|
||||
// player 2 value with 1000. Also update population[] with the
|
||||
// number of pieces of each player.
|
||||
printBoard = function
|
||||
population[1] = 0
|
||||
population[2] = 0
|
||||
for y in range(0, 6)
|
||||
if y == 0 or y == 6 then
|
||||
print " 0 1 2 3 4 5 0"
|
||||
else
|
||||
print " " + y, " "
|
||||
for x in range(1, 5)
|
||||
kIndex = K.indexOf(N[x][y])
|
||||
if kIndex == null then
|
||||
print " ", " "
|
||||
N[x][y] = 0
|
||||
else if kIndex < 9 then
|
||||
print "*", " "
|
||||
N[x][y] = 100
|
||||
population[1] += 1
|
||||
else
|
||||
print "#", " "
|
||||
N[x][y] = 1000
|
||||
population[2] += 1
|
||||
end if
|
||||
end for
|
||||
print y
|
||||
end if
|
||||
end for
|
||||
print
|
||||
end function
|
||||
|
||||
// Function to update the board (N).
|
||||
updateBoard = function
|
||||
for j in range(1,5)
|
||||
for k in range(1,5)
|
||||
if N[j][k] < 100 then continue // not a live cell
|
||||
if N[j][k] > 999 then value = 10 else value = 1
|
||||
for x in range(j-1, j+1)
|
||||
for y in range(k-1, k+1)
|
||||
if x == j and y == k then continue
|
||||
N[x][y] += value
|
||||
//if [x,y] == [2,1] then print "adding " + value + " from " + j+","+k + " to " + x+","+y + ", --> " + N[x][y]
|
||||
end for
|
||||
end for
|
||||
end for
|
||||
end for
|
||||
end function
|
||||
|
||||
|
||||
// Get initial player positions.
|
||||
for player in [1,2]
|
||||
print; print "Player " + player + " - 3 live pieces."
|
||||
if player == 2 then value = 30 else value = 3
|
||||
for k in range(1,3)
|
||||
pos = getCoords
|
||||
N[pos[0]][pos[1]] = value
|
||||
end for
|
||||
end for
|
||||
|
||||
printBoard
|
||||
while true
|
||||
updateBoard
|
||||
printBoard
|
||||
if population[1] == 0 and population[2] == 0 then
|
||||
print "A DRAW"
|
||||
break
|
||||
else if population[1] == 0 then
|
||||
print "PLAYER 2 IS THE WINNER"
|
||||
break
|
||||
else if population[2] == 0 then
|
||||
print "PLAYER 1 IS THE WINNER"
|
||||
break
|
||||
end if
|
||||
|
||||
print; print "Player 1 (*)"
|
||||
p1pos = getCoords
|
||||
print; print "Player 2 (#)"
|
||||
p2pos = getCoords
|
||||
if p1pos == p2pos then
|
||||
print "Same coord. Set to 0"
|
||||
else
|
||||
N[p1pos[0]][p1pos[1]] = 100
|
||||
N[p2pos[0]][p2pos[1]] = 1000
|
||||
end if
|
||||
end while
|
||||
@@ -0,0 +1,22 @@
|
||||
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
|
||||
|
||||
Conversion to [MiniScript](https://miniscript.org).
|
||||
|
||||
Ways to play:
|
||||
|
||||
0. Try-It! Page:
|
||||
Go to https://miniscript.org/tryit/, clear the sample code from the code editor, and paste in the contents of litquiz.ms. Then click the "Run Script" button. Program output (and input) will appear in the green-on-black terminal display to the right of or below the code editor.
|
||||
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript litquiz.ms
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "litquiz"
|
||||
run
|
||||
```
|
||||
@@ -0,0 +1,66 @@
|
||||
print " "*24 + "Literature Quiz"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
|
||||
r=0
|
||||
print "Test your knowledge of children's literature."
|
||||
print; print "This is a multiple-choice quiz."
|
||||
print "Type a 1, 2, 3, or 4 after the question mark."
|
||||
print; print "Good luck!";
|
||||
|
||||
print; print
|
||||
print "In pinocchio, what was the name of the cat?"
|
||||
print "1)Tigger, 2)Cicero, 3)Figaro, 4)Fuipetto";
|
||||
a = input("?").val
|
||||
if a!=3 then
|
||||
print "Sorry...Figaro was his name."
|
||||
else
|
||||
print "Very good! Here's another."
|
||||
r += 1
|
||||
end if
|
||||
|
||||
print; print
|
||||
print "From whose garden did Bugs Bunny steal the carrots?"
|
||||
print "1)Mr. Nixon's, 2)Elmer Fudd's, 3)Clem Judd's, 4)Stromboli's";
|
||||
a = input("?").val
|
||||
if a != 2 then
|
||||
print "Too bad...it was elmer fudd's garden."
|
||||
else
|
||||
print "Pretty good!"
|
||||
r += 1
|
||||
end if
|
||||
|
||||
print; print
|
||||
print "In the Wizard of Oz, Dorothy's dog was named"
|
||||
print "1)Cicero, 2)Trixia, 3)King, 4)Toto";
|
||||
a = input("?").val
|
||||
if a != 4 then
|
||||
print "Back to the books,...Toto was his name."
|
||||
else
|
||||
print "Yea! You're a real literature giant."
|
||||
r += 1
|
||||
end if
|
||||
|
||||
print;print
|
||||
print "Who was the fair maiden who ate the poison apple?"
|
||||
print "1)Sleeping Beauty, 2)Cinderella, 3)Snow White, 4)Wendy";
|
||||
a = input("?").val
|
||||
if a != 3 then
|
||||
print "Oh, come on now...it was Snow White."
|
||||
else
|
||||
print "Good memory!"
|
||||
r += 1
|
||||
end if
|
||||
|
||||
print;print
|
||||
if r == 4 then
|
||||
print "Wow! That's super! You really know your nursery"
|
||||
print "Your next quiz will be on 2nd century Chinese"
|
||||
print "literature (ha, ha, ha)"
|
||||
else if r<2 then
|
||||
print "Ugh. That was definitely not too swift. Back to"
|
||||
print "nursery school for you, my friend."
|
||||
else
|
||||
print "Not bad, but you might spend a little more time"
|
||||
print "reading the nursery greats."
|
||||
end if
|
||||
22
00_Alternate_Languages/58_Love/MiniScript/README.md
Normal file
22
00_Alternate_Languages/58_Love/MiniScript/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
|
||||
|
||||
Conversion to [MiniScript](https://miniscript.org).
|
||||
|
||||
Ways to play:
|
||||
|
||||
0. Try-It! Page:
|
||||
Go to https://miniscript.org/tryit/, clear the sample code from the code editor, and paste in the contents of love.ms. Then click the "Run Script" button. Program output (and input) will appear in the green-on-black terminal display to the right of or below the code editor.
|
||||
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript love.ms
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "love"
|
||||
run
|
||||
```
|
||||
41
00_Alternate_Languages/58_Love/MiniScript/love.ms
Normal file
41
00_Alternate_Languages/58_Love/MiniScript/love.ms
Normal file
@@ -0,0 +1,41 @@
|
||||
print " "*33 + "LOVE"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
|
||||
print "A tribute to the great american artist, Robert Indiana."
|
||||
print "His greatest work will be reproduced with a message of"
|
||||
print "your choice up to 60 characters. If you can't think of"
|
||||
print "a message, simple type the word 'LOVE'"; print
|
||||
msg = input("Your message, please? ")
|
||||
for i in range(1, 10); print; end for
|
||||
|
||||
repeatedMsg = msg * ceil(60 / msg.len)
|
||||
|
||||
data = []
|
||||
data += [60,1,12,26,9,12,3,8,24,17,8,4,6,23,21,6,4,6,22,12,5,6,5]
|
||||
data += [4,6,21,11,8,6,4,4,6,21,10,10,5,4,4,6,21,9,11,5,4]
|
||||
data += [4,6,21,8,11,6,4,4,6,21,7,11,7,4,4,6,21,6,11,8,4]
|
||||
data += [4,6,19,1,1,5,11,9,4,4,6,19,1,1,5,10,10,4,4,6,18,2,1,6,8,11,4]
|
||||
data += [4,6,17,3,1,7,5,13,4,4,6,15,5,2,23,5,1,29,5,17,8]
|
||||
data += [1,29,9,9,12,1,13,5,40,1,1,13,5,40,1,4,6,13,3,10,6,12,5,1]
|
||||
data += [5,6,11,3,11,6,14,3,1,5,6,11,3,11,6,15,2,1]
|
||||
data += [6,6,9,3,12,6,16,1,1,6,6,9,3,12,6,7,1,10]
|
||||
data += [7,6,7,3,13,6,6,2,10,7,6,7,3,13,14,10,8,6,5,3,14,6,6,2,10]
|
||||
data += [8,6,5,3,14,6,7,1,10,9,6,3,3,15,6,16,1,1]
|
||||
data += [9,6,3,3,15,6,15,2,1,10,6,1,3,16,6,14,3,1,10,10,16,6,12,5,1]
|
||||
data += [11,8,13,27,1,11,8,13,27,1,60]
|
||||
|
||||
for row in range(0, 35)
|
||||
s = []
|
||||
a1 = 0; p = true
|
||||
while a1 < 60
|
||||
a = data.pull
|
||||
a1 += a
|
||||
for i in range(a1-a, a1-1)
|
||||
s.push repeatedMsg[i] * p + " " * (not p)
|
||||
end for
|
||||
p = not p
|
||||
end while
|
||||
print s.join("")
|
||||
wait 0.1 // OPTIONAL; slows printing down so you can see it all
|
||||
end for
|
||||
@@ -0,0 +1,19 @@
|
||||
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
|
||||
|
||||
Conversion to [MiniScript](https://miniscript.org). Note that there are three different programs in this folder, all variations on the "land the LEM on the Moon" idea.
|
||||
|
||||
Ways to play:
|
||||
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the desired program with a command such as:
|
||||
|
||||
```
|
||||
miniscript lem.ms
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "lem" // (or "lunar" or "rocket")
|
||||
run
|
||||
```
|
||||
324
00_Alternate_Languages/59_Lunar_LEM_Rocket/MiniScript/lem.ms
Normal file
324
00_Alternate_Languages/59_Lunar_LEM_Rocket/MiniScript/lem.ms
Normal file
@@ -0,0 +1,324 @@
|
||||
print " "*34 + "LEM"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
// rockt2 is an interactive game that simulates a lunar
|
||||
// landing is similar to that of the apollo program.
|
||||
// There is absolutely no chance involved
|
||||
|
||||
|
||||
printIntro = function
|
||||
print
|
||||
print " You are on a lunar landing mission. as the pilot of"
|
||||
print "the lunar excursion module, you will be expected to"
|
||||
print "give certain commands to the module navigation system."
|
||||
print "The on-board computer will give a running account"
|
||||
print "of information needed to navigate the ship."
|
||||
print
|
||||
input "(Press Return.)"
|
||||
print
|
||||
print "The attitude angle called for is described as follows."
|
||||
print "+ or -180 degrees is directly away from the moon"
|
||||
print "-90 degrees is on a tangent in the direction of orbit"
|
||||
print "+90 degrees is on a tangent from the direction of orbit"
|
||||
print "0 (zero) degrees is directly toward the moon"
|
||||
print
|
||||
print " "*30 + "-180|+180"
|
||||
print " "*34 + "^"
|
||||
print " "*27 + "-90 < -+- > +90"
|
||||
print " "*34 + "!"
|
||||
print " "*34 + "0"
|
||||
print " "*21 + "<<<< direction of orbit <<<<"
|
||||
print
|
||||
print " "*20 + "------ surface of moon ------"
|
||||
print
|
||||
input
|
||||
print
|
||||
print "All angles between -180 and +180 degrees are accepted."
|
||||
print
|
||||
print "1 fuel unit = 1 sec. at max thrust"
|
||||
print "Any discrepancies are accounted for in the use of fuel"
|
||||
print "for an attitude change."
|
||||
print "Available engine power: 0 (zero) and any value between"
|
||||
print "10 and 100 percent."
|
||||
print
|
||||
print "Negative thrust or time is prohibited."
|
||||
print
|
||||
input
|
||||
end function
|
||||
|
||||
printInOutInfo = function(withExample = true)
|
||||
print
|
||||
print "Input: time interval in seconds ------ (T)"
|
||||
print " percentage of thrust ---------- (P)"
|
||||
print " attitude angle in degrees ----- (A)"
|
||||
print
|
||||
if withExample then
|
||||
print "For example:"
|
||||
print "T,P,A? 10,65,-60"
|
||||
print "To abort the mission at any time, enter 0,0,0"
|
||||
print
|
||||
end if
|
||||
print "Output: total time in elapsed seconds"
|
||||
print " height in " + ms
|
||||
print " distance from landing site in " + ms
|
||||
print " vertical velocity in " + ms + "/second"
|
||||
print " horizontal velocity in " + ms + "/second"
|
||||
print " fuel units remaining"
|
||||
print
|
||||
end function
|
||||
|
||||
initState = function
|
||||
globals.m = 17.95
|
||||
globals.f1 = 5.25
|
||||
globals.n = 7.5
|
||||
globals.r0 = 926
|
||||
globals.v0 = 1.29
|
||||
globals.t = 0
|
||||
globals.h0 = 60
|
||||
globals.r = r0+h0
|
||||
globals.a = -3.425
|
||||
globals.r1 = 0
|
||||
globals.a1 = 8.84361e-04
|
||||
globals.r3 = 0
|
||||
globals.a3 = 0
|
||||
globals.m1 = 7.45
|
||||
globals.m0 = m1
|
||||
globals.b = 750
|
||||
globals.t1 = 0
|
||||
globals.f = 0
|
||||
globals.p = 0
|
||||
globals.n = 1
|
||||
globals.m2 = 0
|
||||
globals.s = 0
|
||||
globals.c = 0
|
||||
end function
|
||||
|
||||
getUnits = function(moreHelp=true)
|
||||
print
|
||||
while true
|
||||
print "Input measurement option number? ", ""
|
||||
if moreHelp then
|
||||
print
|
||||
print "Which system of measurement do you prefer?"
|
||||
print " 1 = metric 0 = english"
|
||||
print "Enter the appropriate number? ", ""
|
||||
end if
|
||||
k = input.val
|
||||
if k == 0 then
|
||||
globals.z = 6080
|
||||
globals.ms = "feet"
|
||||
globals.g3 = .592
|
||||
globals.ns = "n.miles"
|
||||
globals.g5 = z
|
||||
break
|
||||
else if k == 1 then
|
||||
globals.z = 1852.8
|
||||
globals.ms="meters"
|
||||
globals.g3 = 3.6
|
||||
globals.ns=" kilometers"
|
||||
globals.g5 = 1000
|
||||
break
|
||||
end if
|
||||
moreHelp = true
|
||||
end while
|
||||
end function
|
||||
|
||||
startFirstGame = function
|
||||
initState
|
||||
print
|
||||
print "Lunar Landing Simulation"
|
||||
print
|
||||
print "Have you flown an Apollo/LEM mission before", ""
|
||||
while true
|
||||
qs = input(" (yes or no)? ").lower
|
||||
if qs and (qs[0] == "y" or qs[0] == "n") then break
|
||||
print "Just answer the question, please, ", ""
|
||||
end while
|
||||
getUnits (qs[0] == "n")
|
||||
if qs[0] == "n" then printIntro
|
||||
printInOutInfo
|
||||
end function
|
||||
|
||||
startSubsequentGame = function
|
||||
initState
|
||||
print
|
||||
print "OK, do you want the complete instructions or the input -"
|
||||
print "output statements?"
|
||||
while true
|
||||
print "1 = complete instructions"
|
||||
print "2 = input-output statements"
|
||||
print "3 = neither"
|
||||
b1 = input.val
|
||||
if 1 <= b1 <= 3 then break
|
||||
end while
|
||||
if b1 == 1 then printIntro
|
||||
if b1 < 3 then printInOutInfo
|
||||
end function
|
||||
|
||||
getTurnInputs = function
|
||||
while true
|
||||
print
|
||||
inp = input("T,P,A? ").replace(",", " ").replace(" ", " ").split
|
||||
if inp.len != 3 then continue
|
||||
globals.t1 = inp[0].val // NOTE: though we prompt for T, P, A,
|
||||
globals.f = inp[1].val // internally these are t1, f, and p respectively.
|
||||
globals.p = inp[2].val
|
||||
globals.f = f/100
|
||||
if t1 < 0 then
|
||||
print
|
||||
print "This spacecraft is not able to violate the space-";
|
||||
print "time continuum."
|
||||
continue
|
||||
else if t1 == 0 then
|
||||
return // abort mission
|
||||
end if
|
||||
if f < 0 or f > 1.05 or abs(f-.05) < .05 then
|
||||
print
|
||||
print "Impossible thrust value: ", ""
|
||||
if f < 0 then
|
||||
print "negative"
|
||||
else if f < 0.5 then
|
||||
print "too small"
|
||||
else
|
||||
print "too large"
|
||||
end if
|
||||
continue
|
||||
end if
|
||||
if abs(p) > 180 then
|
||||
print
|
||||
print "If you want to spin around, go outside the module"
|
||||
print "for an E.V.A."
|
||||
continue
|
||||
end if
|
||||
return
|
||||
end while
|
||||
end function
|
||||
|
||||
pad = function(num, width=10)
|
||||
anum = abs(num)
|
||||
if anum >= 10000 then
|
||||
s = round(num)
|
||||
else if anum >= 10000 then
|
||||
s = round(num, 1)
|
||||
else if anum > 100 then
|
||||
s = round(num, 2)
|
||||
else
|
||||
s = round(num, 3)
|
||||
end if
|
||||
return (s + " " * width)[:width]
|
||||
end function
|
||||
|
||||
integrate = function
|
||||
n = 20
|
||||
if t1 >= 400 then n = t1/20
|
||||
globals.t1 = t1/n
|
||||
globals.p = p*3.14159/180
|
||||
s = sin(p)
|
||||
c = cos(p)
|
||||
globals.m2 = m0*t1*f/b
|
||||
globals.r3 = -.5*r0*((v0/r)^2)+r*a1*a1
|
||||
globals.a3 = -2*r1*a1/r
|
||||
|
||||
for i in range(1, n)
|
||||
if m1 != 0 then
|
||||
globals.m1 = m1-m2
|
||||
if m1<=0 then
|
||||
globals.f = f*(1+m1/m2)
|
||||
globals.m2 = m1+m2
|
||||
print "You are out of fuel."
|
||||
globals.m1 = 0
|
||||
end if
|
||||
else
|
||||
globals.f = 0
|
||||
globals.m2 = 0
|
||||
end if
|
||||
globals.m = m-.5*m2
|
||||
globals.r4 = r3
|
||||
globals.r3 = -.5*r0*((v0/r)^2)+r*a1*a1
|
||||
globals.r2 = (3*r3-r4)/2+.00526*f1*f*c/m
|
||||
globals.a4 = a3
|
||||
globals.a3 = -2*r1*a1/r
|
||||
globals.a2 = (3*a3-a4)/2+.0056*f1*f*s/(m*r)
|
||||
globals.x = r1*t1+.5*r2*t1*t1
|
||||
globals.r = r+x
|
||||
globals.h0 = h0+x
|
||||
globals.r1 = r1+r2*t1
|
||||
globals.a = a+a1*t1+.5*a2*t1*t1
|
||||
globals.a1 = a1+a2*t1
|
||||
globals.m = m-.5*m2
|
||||
globals.t = t+t1
|
||||
if h0<3.287828e-04 then break
|
||||
end for
|
||||
|
||||
globals.h = h0*z
|
||||
globals.h1 = r1*z
|
||||
globals.d = r0*a*z
|
||||
globals.d1 = r*a1*z
|
||||
globals.t2 = m1*b/m0
|
||||
|
||||
print " " + [pad(t, 10), pad(h, 10), pad(d, 10), pad(h1, 10), pad(d1, 10), pad(t2, 10)].join
|
||||
end function
|
||||
|
||||
// Do one turn of the game. Return true if game still in progress,
|
||||
// or false when game is over (aborted, crashed, or landed).
|
||||
doOneTurn = function
|
||||
if m1 == 0 then
|
||||
// out of fuel!
|
||||
globals.t1 = 20
|
||||
globals.f = 0
|
||||
globals.p = 0
|
||||
else
|
||||
getTurnInputs
|
||||
end if
|
||||
if t1 == 0 then
|
||||
print "Mission abended"
|
||||
return false
|
||||
end if
|
||||
integrate
|
||||
|
||||
if h0 < 3.287828e-04 then
|
||||
if r1 < -8.21957e-04 or abs(r*a1) > 4.93174e-04 or h0 < -3.287828e-04 then
|
||||
print
|
||||
print "Crash !!!!!!!!!!!!!!!!"
|
||||
print "Your impact created a crater " + abs(h) + " " + ms + " deep."
|
||||
x1 = sqr(d1*d1+h1*h1)*g3
|
||||
print "At contact you were traveling " + x1 + " " + ns + "/hr"
|
||||
else if abs(d)>10*z then
|
||||
print "You are down safely - "
|
||||
print
|
||||
print "But missed the landing site by" + abs(d/g5) + " " + ns + "."
|
||||
else
|
||||
print
|
||||
print "Tranquility Base here -- the Eagle has landed."
|
||||
print "Congratulations -- there was no spacecraft damage."
|
||||
print "You may now proceed with surface exploration."
|
||||
end if
|
||||
return false
|
||||
end if
|
||||
|
||||
if r0*a>164.474 then
|
||||
print
|
||||
print "You have been lost in space with no hope of recovery."
|
||||
return false
|
||||
end if
|
||||
return true
|
||||
end function
|
||||
|
||||
startFirstGame
|
||||
while true
|
||||
t1 = 0; f = 0; p = 0
|
||||
integrate
|
||||
while doOneTurn
|
||||
end while
|
||||
print
|
||||
while true
|
||||
qs = input("Do you want to try it again (yes/no)? ").lower
|
||||
if qs and (qs[0] == "y" or qs[0] == "n") then break
|
||||
end while
|
||||
if qs[0] == "n" then
|
||||
print
|
||||
print "Too bad, the space program hates to lose experienced"
|
||||
print "astronauts."
|
||||
break
|
||||
end if
|
||||
startSubsequentGame
|
||||
end while
|
||||
114
00_Alternate_Languages/59_Lunar_LEM_Rocket/MiniScript/lunar.ms
Normal file
114
00_Alternate_Languages/59_Lunar_LEM_Rocket/MiniScript/lunar.ms
Normal file
@@ -0,0 +1,114 @@
|
||||
print " "*33 + "Lunar"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
print "This is a computer simulation of an Apollo lunar"
|
||||
print "landing capsule."; print; print
|
||||
print "The on-board computer has failed (it was made by"
|
||||
print "Xerox) so you have to land the capsule manually."
|
||||
|
||||
printCols = function(fields, delimiter=null)
|
||||
if delimiter == null then delimiter = text.delimiter
|
||||
line = ""
|
||||
for s in fields
|
||||
line += (s + " "*12)[:12]
|
||||
end for
|
||||
print line, delimiter
|
||||
end function
|
||||
|
||||
doOneGame = function
|
||||
print; print "Set burn rate of retro rockets to any value between"
|
||||
print "0 (free fall) and 200 (maximum burn) pounds per second."
|
||||
print "Set new burn rate every 10 seconds."; print
|
||||
print "Capsule weight 32,500 lbs; fuel weight 16,500 lbs."
|
||||
print; print; print; print "Good luck"
|
||||
l = 0
|
||||
|
||||
print
|
||||
printCols ["sec","mi + ft","mph","lb fuel","burn rate"]
|
||||
print
|
||||
a=120; v = 1; m=33000; n=16500; g=1e-03; z = 1.8
|
||||
|
||||
formulaSet1 = function // (subroutine 330)
|
||||
outer.l += s
|
||||
outer.t -= s
|
||||
outer.m -= s * k
|
||||
outer.a = i
|
||||
outer.v = j
|
||||
end function
|
||||
|
||||
formulaSet2 = function // (subroutine 420)
|
||||
outer.q = s * k / m
|
||||
outer.j = v + g*s + z*(-q-q*q/2-q^3/3-q^4/4-q^5/5)
|
||||
outer.i = a - g*s*s/2 - v*s+z*s*(q/2+q^2/6+q^3/12+q^4/20+q^5/30)
|
||||
end function
|
||||
|
||||
formulaSet3 = function // (loop 340-360)
|
||||
while s >= 5e-3
|
||||
outer.d = v + sqrt(v * v + 2 * a * (g - z * k / m))
|
||||
outer.s = 2 * a / d
|
||||
formulaSet2
|
||||
formulaSet1
|
||||
end while
|
||||
end function
|
||||
|
||||
while true
|
||||
printCols [l, floor(a) + " " + floor(5280*(a-floor(a))), 3600*v, m-n], ""
|
||||
k = input.val
|
||||
t=10
|
||||
shouldExit = false
|
||||
|
||||
while true
|
||||
if m-n < 1e-03 then break
|
||||
if t < 1e-03 then break
|
||||
s = t; if m < n+s*k then s = (m-n)/k
|
||||
formulaSet2
|
||||
if i <= 0 then
|
||||
formulaSet3
|
||||
shouldExit = true
|
||||
break
|
||||
end if
|
||||
if v > 0 and j < 0 then
|
||||
while v > 0 and j <= 0
|
||||
w = (1 - m*g/(z*k))/2
|
||||
s = m*v / (z*k*(w + sqrt(w*w + v/z))) + 0.05
|
||||
formulaSet2
|
||||
if i <= 0 then
|
||||
formulaSet3
|
||||
shouldExit = true
|
||||
break
|
||||
end if
|
||||
formulaSet1
|
||||
end while
|
||||
if shouldExit then break
|
||||
continue
|
||||
end if
|
||||
formulaSet1
|
||||
end while
|
||||
if shouldExit then break
|
||||
if m-n < 1e-03 then
|
||||
print "Fuel out at " + round(l) + " seconds"
|
||||
s = (-v+sqrt(v*v+2*a*g))/g
|
||||
v = v+g*s; l = l+s
|
||||
break
|
||||
end if
|
||||
end while
|
||||
|
||||
w = 3600*v
|
||||
print "On moon at " + l + " seconds - impact velocity " + round(w,1) + " mph"
|
||||
if w <= 1.2 then
|
||||
print "Perfect landing!"
|
||||
else if w <= 10 then
|
||||
print "Good landing (could be better)"
|
||||
else if w <= 60 then
|
||||
print "Craft damage... you're stranded here until a rescue"
|
||||
print "party arrives. Hope you have enough oxygen!"
|
||||
else
|
||||
print "Sorry there were no survivors. You blew it!"
|
||||
print "In fact, you blasted a new lunar crater " + round(w*.227,1) + " feet deep!"
|
||||
end if
|
||||
end function
|
||||
|
||||
while true
|
||||
doOneGame
|
||||
print; print; print; print "Try again??"
|
||||
end while
|
||||
101
00_Alternate_Languages/59_Lunar_LEM_Rocket/MiniScript/rocket.ms
Normal file
101
00_Alternate_Languages/59_Lunar_LEM_Rocket/MiniScript/rocket.ms
Normal file
@@ -0,0 +1,101 @@
|
||||
if version.hostName == "Mini Micro" then clear
|
||||
print " "*30 + "Rocket"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
print "Lunar Landing Simulation"
|
||||
print "----- ------- ----------"; print
|
||||
yn = input("Do you want instructions (yes or no)? ").lower
|
||||
if not yn or yn[0] != "n" then
|
||||
print
|
||||
print "You are landing on the moon and and have taken over manual"
|
||||
print "control 1000 feet above a good landing spot. You have a down-"
|
||||
print "ward velocity of 50 feet/sec. 150 units of fuel remain."
|
||||
print
|
||||
print "Here are the rules that govern your Apollo space-craft"
|
||||
print "(Press Return after each one):"; print
|
||||
print "(1) After each second the height, velocity, and remaining fuel"
|
||||
print " will be reported via Digby your on-board computer."
|
||||
input
|
||||
print "(2) After the report a '?' will appear. Enter the number"
|
||||
print " of units of fuel you wish to burn during the next"
|
||||
print " second. Each unit of fuel will slow your descent by"
|
||||
print " 1 foot/sec."
|
||||
input
|
||||
print "(3) The maximum thrust of your engine is 30 feet/sec/sec"
|
||||
print " or 30 units of fuel per second."
|
||||
input
|
||||
print "(4) When you contact the lunar surface, your descent engine"
|
||||
print " will automatically shut down and you will be given a"
|
||||
print " report of your landing speed and remaining fuel."
|
||||
input
|
||||
print "(5) If you run out of fuel the '?' will no longer appear"
|
||||
print " but your second by second report will continue until"
|
||||
print " you contact the lunar surface."; print
|
||||
input
|
||||
end if
|
||||
|
||||
pad = function(s, width=10)
|
||||
return (s + " "*width)[:width]
|
||||
end function
|
||||
|
||||
// Bonus little feature when running in Mini Micro: display a header bar
|
||||
// always at the top of the screen.
|
||||
drawHeaders = function
|
||||
display(2).mode = displayMode.text; td = display(2)
|
||||
td.color = text.color; td.backColor = color.black
|
||||
td.row = 25; td.column = 0
|
||||
td.print "sec feet speed fuel plot of distance" + " "*21
|
||||
end function
|
||||
|
||||
while true
|
||||
print "Beginning landing procedure.........."; print
|
||||
print "G O O D L U C K ! ! !"
|
||||
print; print
|
||||
print "sec feet speed fuel plot of distance"
|
||||
drawHeaders
|
||||
print
|
||||
t=0; h=1000; v=50; fuel=150
|
||||
while true
|
||||
print pad(t,5) + pad(h,7) + pad(v, 10) + pad(fuel,8) + "|" + " "*floor(h/30) + "*"
|
||||
if fuel <= 0 then
|
||||
burn = 0
|
||||
wait 0.5 // (slight pause for drama and legibility)
|
||||
else
|
||||
burn = input("?").val
|
||||
if burn < 0 then burn = 0
|
||||
if burn > 30 then burn=30
|
||||
if burn > fuel then
|
||||
burn = fuel
|
||||
print "**** out of fuel ****"
|
||||
end if
|
||||
end if
|
||||
v1 = v - burn + 5
|
||||
fuel -= burn
|
||||
h -= .5*(v+v1)
|
||||
if h <= 0 then break
|
||||
t += 1
|
||||
v = v1
|
||||
end while
|
||||
print "***** CONTACT *****"
|
||||
h = h+ .5*(v1+v)
|
||||
if burn == 5 then
|
||||
d = h/v
|
||||
else
|
||||
d = (-v+sqrt(v*v+h*(10-2*burn)))/(5-burn)
|
||||
end if
|
||||
v1 = v + (5-burn)*d
|
||||
print "Touchdown at " + (t+d) + " seconds."
|
||||
print "Landing velocity = " + round(v1,1) + " feet/sec."
|
||||
print fuel + " units of fuel remaining."
|
||||
if v1 == 0 then
|
||||
print "Congratulations! a perfect landing!!"
|
||||
print "Your license will be renewed.......later."
|
||||
else if abs(v1) >= 2 then
|
||||
print "***** Sorry, but you blew it!!!!"
|
||||
print "Appropriate condolences will be sent to your next of kin."
|
||||
end if
|
||||
print; print; print
|
||||
yn = input("Another mission? ").lower
|
||||
if not yn or yn[0] != "y" then break
|
||||
end while
|
||||
print; print "Control out."; print
|
||||
@@ -7,13 +7,15 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript nicomachus.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "nicomachus"
|
||||
run
|
||||
|
||||
```
|
||||
3. "Try-It!" page on the web:
|
||||
Go to https://miniscript.org/tryit/, clear the default program from the source code editor, paste in the contents of nicomachus.ms, and click the "Run Script" button.
|
||||
|
||||
@@ -7,13 +7,15 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript number.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "number"
|
||||
run
|
||||
|
||||
```
|
||||
3. "Try-It!" page on the web:
|
||||
Go to https://miniscript.org/tryit/, clear the default program from the source code editor, paste in the contents of number.ms, and click the "Run Script" button.
|
||||
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript sinewave.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "sinewave"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript number.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "number"
|
||||
run
|
||||
```
|
||||
@@ -7,13 +7,15 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript train.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "train"
|
||||
run
|
||||
|
||||
```
|
||||
3. "Try-It!" page on the web:
|
||||
Go to https://miniscript.org/tryit/, clear the default program from the source code editor, paste in the contents of train.ms, and click the "Run Script" button.
|
||||
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript trap.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "trap"
|
||||
run
|
||||
```
|
||||
@@ -7,10 +7,13 @@ Ways to play:
|
||||
1. Command-Line MiniScript:
|
||||
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
|
||||
|
||||
```
|
||||
miniscript war.ms
|
||||
|
||||
```
|
||||
2. Mini Micro:
|
||||
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
|
||||
|
||||
```
|
||||
load "war"
|
||||
run
|
||||
```
|
||||
Reference in New Issue
Block a user