Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miniscript batch 8 #902

Merged
merged 15 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ end function
// Bonus little feature when running in Mini Micro: display a header bar
// always at the top of the screen.
drawHeaders = function
if version.hostName != "Mini Micro" then return
display(2).mode = displayMode.text; td = display(2)
td.color = text.color; td.backColor = color.black
td.row = 25; td.column = 0
Expand Down
18 changes: 18 additions & 0 deletions 00_Alternate_Languages/69_Pizza/MiniScript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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 pizza.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 "pizza"
run
```
98 changes: 98 additions & 0 deletions 00_Alternate_Languages/69_Pizza/MiniScript/pizza.ms
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
print " "*33 + "Pizza"
print " "*15 + "Creative Computing Morristown, New Jersey"
print; print; print
print "Pizza Delivery Game"; print
name = input("What is your first name? "); print
print "Hi, " + name + ". In this game you are to take orders"
print "for pizzas. Then you are to tell a delivery boy"
print "where to deliver the ordered pizzas."; print; print

// Convert a house name like "G" into coordinates like [3,2].
nameToCoords = function(name)
idx = name.code - "A".code
row = floor(idx / 4)
col = idx % 4
return [col+1, row+1]
end function

// Convert house coordinates like [3,2] into a house name like "G".
coordsToName = function(coords)
idx = (coords[1]-1)*4 + (coords[0]-1)
return char("A".code + idx)
end function

askYesNo = function(prompt)
while true
yn = input(prompt + "? ").lower + " "
if yn[0] == "y" then return "yes"
if yn[0] == "n" then return "no"
print "'Yes' or 'no' please, now then,"
end while
end function

input "(Press Return.)"; print

print "Map of the city of Hyattsville"; print
print " -----1-----2-----3-----4-----"
for row in range(4, 1)
print "-"; print "-"; print "-"
s = row + " "
for col in range(1, 4)
s += coordsToName([col, row]) + " "
end for
s += row
print s
end for
print "-"; print "-"; print "-"
print " -----1-----2-----3-----4-----"

input
print "The output is a map of the homes where"
print "you are to send pizzas."; print
print "Your job is to give a truck driver"
print "the location or coordinates of the"
print "home ordering the pizza."; print
if askYesNo("Do you need more directions") == "yes" then
print; print "Somebody will ask for a pizza to be"
print "delivered. Then a delivery boy will"
print "ask you for the location.";
print " Example:"
print "This is J. Please send a pizza."
print "Driver to " + name + ". Where does j live?"
print "Your answer would be 2,3"; print
if askYesNo("Understand") == "no" then
print "This job is definitely too difficult for you. Thanks anyway"
exit
end if
print "Good. you are now ready to start taking orders."; print
print "Good luck!!"; print
end if

while true
for turn in range(1,5)
coords = [floor(rnd*4+1), floor(rnd*4+1)]
buyer = coordsToName(coords)
print "Hello " + name + "'s Pizza. This is " + buyer +
". Please send a pizza."
while true
while true
inp = input(" Driver to " + name + ": Where does " + buyer + " live? ")
inp = inp.replace(",", " ").replace(" ", " ")
inp = inp.split + [0,0]
guess = [inp[0].val, inp[1].val]
if 1 <= guess[0] <= 4 and 1 <= guess[1] <= 4 then break
end while
if guess == coords then
print "Hello " + name + ". This is " + buyer + ", thanks for the pizza."
break
else
print "This is " + coordsToName(guess) + ". I did not order a pizza."
print "I live at " + guess.join(",")
end if
end while
print
end for
if askYesNo("Do you want to deliver more pizzas") == "no" then break
end while

print; print "O.K. " + name + ", see you later!"; print
18 changes: 18 additions & 0 deletions 00_Alternate_Languages/70_Poetry/MiniScript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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 poetry.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 "poetry"
run
```
51 changes: 51 additions & 0 deletions 00_Alternate_Languages/70_Poetry/MiniScript/poetry.ms
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
print " "*30 + "POETRY"
print " "*15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
print; print; print

I = 0; J = 0; K = 0; U = 0

// Note: infinite loop. Press control-C to break.
while true
if J == 1 then
print ["MIDNIGHT DREARY", "FIERY EYES",
"BIRD OR FIEND", "THING OF EVIL", "PROPHET"][I-1], ""
else if J == 2 then
if I == 1 or I == 4 then U = 2
if I == 3 then U = 0
print ["BEGUILING ME", "THRILLED ME",
"STILL SITTING....", "NEVER FLITTING", "BURNED"][I-1], ""
else if J == 3 then
if U != 0 or I < 5 then
print ["AND MY SOUL", "DARKNESS THERE",
"SHALL BE LIFTED", "QUOTH THE RAVEN", "SIGN OF PARTING"][I-1], ""
end if
else if J == 4 then
print ["NOTHING MORE", "YET AGAIN",
"SLOWLY CREEPING", "...EVERMORE", "NEVERMORE"][I-1], ""
end if
if U != 0 and rnd <= 0.19 then
print ",", ""
U = 2
end if
if rnd <= 0.65 then
print " ", ""
U += 1
else
print
U = 0
end if
while true
I =floor(floor(10*rnd)/2)+1
J += 1
K += 1
if U == 0 and floor(J/2) == J/2 then print " ", ""
if J <= 5 then break
J = 0
print
if K <= 20 then continue
print
U = 0
K = 0
break
end while
end while
18 changes: 18 additions & 0 deletions 00_Alternate_Languages/71_Poker/MiniScript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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 poker.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 "poker"
run
```
Loading
Loading