Skip to content

Commit 55ec081

Browse files
committed
Added MiniScript version of 79_Slalom.
1 parent 691664d commit 55ec081

File tree

5 files changed

+195
-5
lines changed

5 files changed

+195
-5
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
2+
3+
Conversion to [MiniScript](https://miniscript.org).
4+
5+
Ways to play:
6+
7+
1. Command-Line MiniScript:
8+
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
9+
```
10+
miniscript slalom.ms
11+
```
12+
13+
2. Mini Micro:
14+
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:
15+
```
16+
load "slalom"
17+
run
18+
```
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
print " "*33 + "Slalom"
2+
print " "*15 + "Creative Computing Morristown New Jersey"
3+
print; print; print
4+
5+
gateSpeeds = [14,18,26,29,18,25,28,32,29,20,29,29,25,21,26,29,20,21,20,
6+
18,26,25,33,31,22]
7+
8+
medals = {}
9+
medals.gold = 0
10+
medals.silver = 0
11+
medals.bronze = 0
12+
13+
while true
14+
qtyGates = input("How many gates does this course have (1 to 25)? ").val
15+
if qtyGates > 25 then
16+
print "25 is the limit."
17+
qtyGates = 25
18+
end if
19+
if qtyGates >= 1 then break
20+
print "Try again,"
21+
end while
22+
23+
print "Type ""ins"" for instructions"
24+
print "Type ""max"" for approximate maximum speeds"
25+
print "Type ""run"" for the beginning of the race"
26+
while true
27+
cmd = input("Command--").lower
28+
if cmd == "ins" then
29+
print
30+
print "*** Slalom: This is the 1976 Winter Olympic Giant Slalom. You are"
31+
print " the American team's only hope of a gold medal."
32+
print
33+
print " 0 -- type this if you want to see how long you've taken."
34+
print " 1 -- type this if you want to speed up a lot."
35+
print " 2 -- type this if you want to speed up a little."
36+
print " 3 -- type this if you want to speed up a teensy."
37+
print " 4 -- type this if you want to keep going the same speed."
38+
print " 5 -- type this if you want to check a teensy."
39+
print " 6 -- type this if you want to check a little."
40+
print " 7 -- type this if you want to check a lot."
41+
print " 8 -- type this if you want to cheat and try to skip a gate."
42+
print
43+
print " The place to use these options is when the computer asks:"
44+
print
45+
print "Option?"
46+
print
47+
print " Good luck!"
48+
print
49+
else if cmd == "max" then
50+
print "GATE MAX"
51+
print " # M.P.H."
52+
print "-----------"
53+
for i in range(1, qtyGates)
54+
print " " + i + " "*(i<10) + " " + gateSpeeds[i-1]
55+
end for
56+
else if cmd == "run" then
57+
break
58+
end if
59+
end while
60+
61+
while true
62+
skill = input("Rate yourself as a skier, (1=worst, 3=best)? ").val
63+
if 1 <= skill <= 3 then break
64+
print "The bounds are 1-3"
65+
end while
66+
67+
doOneRace = function
68+
print "The starter counts down...5...4...3...2...1..GO!"
69+
time = 0
70+
speed = floor(rnd * 9 + 9)
71+
print
72+
print "You're off!"
73+
gate = 0
74+
while gate+1 <= qtyGates
75+
gate += 1
76+
gateSpeed = gateSpeeds[(gate-1) % gateSpeeds.len]
77+
print
78+
print "Here comes gate #" + gate + ":"
79+
print speed + " M.P.H."
80+
prevSpeed = speed
81+
while true
82+
opt = input("Option? ").val
83+
if opt == 0 then
84+
print "You've taken " + time + " seconds."
85+
else if opt < 1 or opt > 8 then
86+
print "What?"
87+
else
88+
break
89+
end if
90+
end while
91+
if opt == 1 then
92+
speed += floor(rnd*(10-5)+5)
93+
else if opt == 2 then
94+
speed += floor(rnd*(5-3)+3)
95+
else if opt == 3 then
96+
speed += floor(rnd*(4-1)+1)
97+
else if opt == 4 then
98+
// (no change)
99+
else if opt == 5 then
100+
speed -= floor(rnd*(4-1)+1)
101+
else if opt == 6 then
102+
speed -= floor(rnd*(5-3)+3)
103+
else if opt == 7 then
104+
speed -= floor(rnd*(10-5)+5)
105+
else if opt == 8 then
106+
print "***CHEAT"
107+
if rnd < 0.7 then
108+
print "An official caught you!"
109+
print "You took " + round(time+rnd, 3) + " seconds."
110+
break
111+
else
112+
print "You made it!" + char(7)
113+
time += 1.5
114+
continue
115+
end if
116+
end if
117+
print speed + " M.P.H."
118+
if speed > gateSpeed then
119+
if rnd < (speed - gateSpeed)*0.1 + 0.2 then
120+
msg = "You went over the maximum speed and "
121+
if rnd < 0.5 then msg += "snagged a flag!" else msg += "wiped out!"
122+
print msg
123+
print "You took " + round(time+rnd, 3) + " seconds."
124+
else
125+
print "You went over the maximum speed and made it!"
126+
end if
127+
else if speed > gateSpeed - 1 then
128+
print "Close one!"
129+
end if
130+
if speed < 7 then
131+
print "Let's be realistic, OK? Let's go back and try again..."
132+
speed = prevSpeed
133+
gate -= 1
134+
continue
135+
end if
136+
time += gateSpeed - speed + 1
137+
if speed > gateSpeed then time += 0.5
138+
end while
139+
140+
print
141+
print "You took " + round(time+rnd, 3) + " seconds."
142+
avg = time / qtyGates
143+
if avg < 1.5 - (skill * 0.1) then
144+
print "You won a gold medal!"
145+
medals.gold += 1
146+
else if avg < 2.9 - (skill * 0.1) then
147+
print "You won a silver medal"
148+
medals.silver += 1
149+
else if avg < 4.4 - (skill * 0.01) then
150+
print "You won a bronze medal"
151+
medals.bronze += 1
152+
end if
153+
end function
154+
155+
while true
156+
doOneRace
157+
while true
158+
yesno = input("Do you want to race again? ").lower + " "
159+
if yesno[0] == "y" or yesno[0] == "n" then break
160+
print "Please type 'yes' or 'no'"
161+
end while
162+
if yesno[0] == "n" then break
163+
print
164+
end while
165+
166+
print
167+
print "Thanks for the race"
168+
if medals.gold then print "Gold medals: " + medals.gold
169+
if medals.silver then print "Silver medals: " + medals.silver
170+
if medals.bronze then print "Bronze medals: " + medals.bronze

00_Alternate_Languages/79_Slalom/slalom.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
825 PRINT "*** SLALOM: THIS IS THE 1976 WINTER OLYMPIC GIANT SLALOM. YOU ARE"
5959
830 PRINT " THE AMERICAN TEAM'S ONLY HOPE OF A GOLD MEDAL."
6060
840 PRINT
61-
845 PRINT " 0 -- TYPE THIS IS YOU WANT TO SEE HOW LONG YOU'VE TAKEN."
61+
845 PRINT " 0 -- TYPE THIS IF YOU WANT TO SEE HOW LONG YOU'VE TAKEN."
6262
850 PRINT " 1 -- TYPE THIS IF YOU WANT TO SPEED UP A LOT."
6363
860 PRINT " 2 -- TYPE THIS IF YOU WANT TO SPEED UP A LITTLE."
6464
870 PRINT " 3 -- TYPE THIS IF YOU WANT TO SPEED UP A TEENSY."

79_Slalom/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ As published in Basic Computer Games (1978):
1515
Downloaded from Vintage Basic at
1616
http://www.vintage-basic.net/games.html
1717

18-
#### Porting Notes
18+
#### Known Bugs
19+
20+
- In the original version, the data pointer doesn't reset after a race is completed. This causes subsequent races to error at some future point at line 540, `READ Q'.
1921

20-
In the original version, the data pointer doesn't reset after a race is completed. This causes subsequent races to error at some future point at line 540,
22+
- It also doesn't restore the data pointer after executing the MAX command to see the gate speeds, meaning that if you use this command, it effectively skips those gates, and the speeds shown are completely incorrect.
2123

22-
540 READ Q
24+
#### Porting Notes

79_Slalom/slalom.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
825 PRINT "*** SLALOM: THIS IS THE 1976 WINTER OLYMPIC GIANT SLALOM. YOU ARE"
5959
830 PRINT " THE AMERICAN TEAM'S ONLY HOPE OF A GOLD MEDAL."
6060
840 PRINT
61-
845 PRINT " 0 -- TYPE THIS IS YOU WANT TO SEE HOW LONG YOU'VE TAKEN."
61+
845 PRINT " 0 -- TYPE THIS IF YOU WANT TO SEE HOW LONG YOU'VE TAKEN."
6262
850 PRINT " 1 -- TYPE THIS IF YOU WANT TO SPEED UP A LOT."
6363
860 PRINT " 2 -- TYPE THIS IF YOU WANT TO SPEED UP A LITTLE."
6464
870 PRINT " 3 -- TYPE THIS IF YOU WANT TO SPEED UP A TEENSY."

0 commit comments

Comments
 (0)