Skip to content

Commit 28b1e5f

Browse files
authored
Merge pull request #1 from chinhouse/main
Adding Word, Weekday, 23 Matches, Tower, Target, and Synonym
2 parents b8dd564 + 2899eeb commit 28b1e5f

File tree

16 files changed

+916
-0
lines changed

16 files changed

+916
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 reverse.ms
11+
12+
2. Mini Micro:
13+
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:
14+
15+
load "reverse"
16+
run
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
num = 9
2+
3+
reverse = function(i)
4+
if i == null then return i
5+
ret = []
6+
for item in i
7+
ret.insert(0,item)
8+
end for
9+
return ret
10+
end function
11+
12+
showRules = function
13+
print
14+
print "This is the game of 'Reverse'. To win, all you have"
15+
print "to do is arrange a list of numbers (1 through " + num + ")"
16+
print "in numerical order from left to right. To move, you"
17+
print "tell me how many numbers (counting from the left) to"
18+
print "reverse. For example, if the current list is:"
19+
print; print "2 3 4 5 1 6 7 8 9"
20+
print; print "and you reverse 4, the result will be:"
21+
print; print "5 4 3 2 1 6 7 8 9"
22+
print; print "Now if reverse 5, you win!"
23+
print; print "1 2 3 4 5 6 7 8 9"
24+
print
25+
print "No doubt you will like this game, but"
26+
print "if you want to quit, reverse 0 (zero)."
27+
print
28+
return
29+
end function
30+
31+
printState = function
32+
print;print digits.join(" "); print
33+
end function
34+
35+
print " " * 32 + "REVERSE"
36+
print " " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
37+
print; print; print
38+
print "Reverse -- a game of skill"
39+
print
40+
41+
ans = input("Do you want the rules? ")
42+
if ans != null and ans[0].lower == "y" then showRules
43+
44+
while 1
45+
turns = 0
46+
digits = range(1, num)
47+
digits.shuffle
48+
print;print "Here we go ... the list is:"
49+
while 1
50+
printState
51+
amt = input("How many shall I reverse? ").val
52+
if amt == null or amt == 0 then break
53+
54+
if amt > num then
55+
print "OOPS! Too many! I can reverse at most " + num
56+
else
57+
turns += 1
58+
digits = reverse(digits[:amt]) + digits[amt:]
59+
end if
60+
if digits == range(1,num) then
61+
printState
62+
print "You won it in " + turns + " moves!!"
63+
break
64+
end if
65+
end while
66+
print
67+
ans = input("Try again (YES or NO)? ")
68+
print
69+
if ans == null or ans[0].lower == "n" then break
70+
end while
71+
print "O.K. Hope you had fun!!"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 stars.ms
11+
12+
2. Mini Micro:
13+
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:
14+
15+
load "stars"
16+
run
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
kMaxNum = 100
2+
kTries = 7
3+
4+
instructions = function
5+
print "I am thinking of a whole number from 1 to " + kMaxNum
6+
print "Try to guess my number. After you guess, I"
7+
print "will output one or more stars (*). The more"
8+
print "stars I type, the closer you are to my number."
9+
print "One star (*) means far away, seven stars (*******)"
10+
print "means really close! You get " + kTries + " guesses."
11+
print
12+
end function
13+
14+
print " " * 34 + "STARS"
15+
print " " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
16+
print; print; print
17+
18+
ans = input("Do you want instructions? ").lower
19+
if ans[0] == "y" then
20+
instructions
21+
end if
22+
23+
while 1
24+
print
25+
print "OK, I am thinking of a number, start guessing."
26+
starNum = floor(rnd * kMaxNum) + 1
27+
try = 0
28+
while try < kTries
29+
print
30+
guess = input("Your guess: ").val
31+
32+
if guess == starNum then
33+
break
34+
else
35+
d = abs(guess - starNum)
36+
print "*" * (7 - floor(log(d,2)))
37+
end if
38+
try += 1
39+
end while
40+
41+
if try < kTries then
42+
print "*" * 59
43+
print "You got it in " + (try + 1) + " guesses! Let's play again."
44+
else
45+
print "Sorry, that's " + try + " guesses. The number was " + starNum
46+
end if
47+
print
48+
end while
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 synonym.ms
11+
12+
2. Mini Micro:
13+
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:
14+
15+
load "synonym"
16+
run
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
words = [["first", "start", "beginning", "onset", "initial"],
2+
["similar", "alike", "same", "like", "resembling"],
3+
["model", "pattern", "prototype", "standard", "criterion"],
4+
["small", "insignificant", "little", "tiny", "minute"],
5+
["stop", "halt", "stay", "arrest", "check", "standstill"],
6+
["house", "dwelling", "residence", "domicile", "lodging", "habitation"],
7+
["pit", "hole", "hollow", "well", "gulf", "chasm", "abyss"],
8+
["push", "shove", "thrust", "prod","poke","butt", "press"],
9+
["red", "rouge", "scarlet", "crimson", "flame", "ruby"],
10+
["pain", "suffering", "hurt", "misery", "distress", "ache", "discomfort"]]
11+
12+
words.shuffle
13+
14+
responses = ["Right","Correct","Fine","Good!","Check"]
15+
16+
print " " * 33 + "SYNONYM"
17+
print " " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
18+
print; print; print
19+
print "A synonym of a word means another word in the English"
20+
print "language which has the same or very nearly the same meaning."
21+
print "I choose a word -- you type a synonym."
22+
print "If you can't think a synonym, type the word 'HELP'"
23+
print "and I will tell you a synonym."
24+
print
25+
26+
for synonyms in words
27+
word = synonyms[0]
28+
synonyms = synonyms[1:]
29+
responses.shuffle
30+
31+
print
32+
while 1
33+
guess = input(" What is a synonym of " + word + "? ").lower
34+
if guess == "help" then
35+
synonyms.shuffle
36+
print "**** A synonym of " + word + " is " + synonyms[0] + "."
37+
print
38+
else if guess == word or synonyms.indexOf(guess) == null then
39+
print " Try again."
40+
else
41+
print responses[0]
42+
break
43+
end if
44+
end while
45+
end for
46+
print
47+
print "Synonym drill completed."
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 target.ms
11+
12+
2. Mini Micro:
13+
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:
14+
15+
load "target"
16+
run
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
degToRad = function(n)
2+
return n * pi / 180
3+
end function
4+
5+
radToDeg = function(n)
6+
return n * 180 / pi
7+
end function
8+
9+
roundDown = function(n, r)
10+
return floor(n / r) * r
11+
end function
12+
13+
getCoord = function(distance, radX, radZ)
14+
xc = sin(radZ)*cos(radX)*distance
15+
yc = sin(radZ)*sin(radX)*distance
16+
zc = cos(radZ)*distance
17+
return [xc,yc,zc]
18+
end function
19+
20+
distanceBetween = function (d1,d2)
21+
return ((d1[0]-d2[0])^2 + (d1[1]-d2[1])^2 + (d1[2]-d2[2])^2)^.5
22+
end function
23+
24+
print " " * 33 + "TARGET"
25+
print " " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
26+
print; print; print
27+
28+
print "You are the weapons officer on the Starship Enterprise"
29+
print "and this is a test to see how accurae a shot you"
30+
print "are in a 3-dimensional range. You will be told"
31+
print "the radian offset for the X and Z axes, the location"
32+
print "of the target in 3-dimensional rectangular coordinates,"
33+
print "the approximate number of degrees from the X and Z"
34+
print "axes, and the approximate distance to the target."
35+
print "You will then proceed to shoot at the target until it is"
36+
print "destroyed!"
37+
print; print
38+
print "Good luck!"
39+
roundToList = [20,10,2,1]
40+
ready = true
41+
while ready
42+
turns = -1
43+
radX = rnd * 2 * pi
44+
radZ = rnd * 2 * pi
45+
print "Radians from X axis = " + radX + " from Z axis = " + radZ
46+
47+
distance = 100000 * rnd * rnd
48+
coords = getCoord(distance, radX, radZ)
49+
50+
print "Target sighted: Approx Coordinates (X,Y,Z) = ("+coords.join(",")+")"
51+
52+
gameRunning = true
53+
while gameRunning
54+
turns += 1
55+
if turns >=4 then
56+
estDistance = distance
57+
else
58+
estDistance = roundDown(distance, roundToList[turns])
59+
end if
60+
61+
print " Estimated Distance: " + estDistance
62+
print
63+
tx = input ("Input angle deviation from X in degrees: ").val
64+
tz = input ("Input angle deviation from Z in degrees: ").val
65+
tdist = input ("Input distance: ").val
66+
print
67+
if tdist < 20 then
68+
print "You blew yourself up!!"
69+
gameRunning = false
70+
else
71+
tx = degToRad(tx)
72+
tz = degToRad(tz)
73+
74+
print "Radians from X-axis = " + tx + " from Z-axis = " + tz
75+
targeted = getCoord(tdist, tx,tz)
76+
distBet = distanceBetween(coords, targeted)
77+
if distBet > 20 then
78+
dx = targeted[0] - coords[0]
79+
dy = targeted[1] - coords[1]
80+
dz = targeted[2] - coords[2]
81+
xMsg = {false: "Shot in front of target ", true: "Shot behind target "}
82+
print xMsg[dx<0] + dx + " kilometers."
83+
yMsg = {false: "Shot to left of target ", true: "Shot to right of target "}
84+
print yMsg[dy<0] + dy + " kilometers."
85+
zMsg = {false: "Shot above target ", true: "Shot below target "}
86+
print zMsg[dz<0] + dz + " kilometers."
87+
88+
print "Approx position of explosion + (" + targeted.join(",") + ")"
89+
print " Distance from target = " + distBet
90+
print
91+
print
92+
93+
else
94+
print
95+
print " * * * HIT * * * Target is non-functional"
96+
print
97+
print "Distance of explosion from target was " + distBet + "kilometers."
98+
print
99+
print "Mission accomplished in " + (turns+1) + " shots."
100+
print
101+
gameRunning = false
102+
end if
103+
end if
104+
end while
105+
print
106+
ans = input("Ready for next target? ").lower
107+
if ans == "" then
108+
ready == false
109+
else
110+
ready = ans[0].lower == "y"
111+
end if
112+
print
113+
end while
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 tower.ms
11+
12+
2. Mini Micro:
13+
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:
14+
15+
load "tower"
16+
run

0 commit comments

Comments
 (0)