Ported 66_Number to MiniScript

This commit is contained in:
JoeStrout
2023-01-28 22:57:52 -07:00
parent 0f85e3da49
commit 099368a269
3 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
Conversion to [MiniScript](https://miniscript.org).

View File

@@ -0,0 +1,44 @@
// Number Game
// originally by Tom Adametx
// Ported from BASIC to MiniScript by Joe Strout, 2023
print " "*33 + "NUMBER"
print " "*15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
print; print; print
print "You have 100 points. By guessing numbers from 1 to 5, you"
print "can gain or lose points depending on how close you get to"
print "a random number selected by the computer."; print
print "You occasionally will get a jackpot which will double(!)"
print "your point count. You win when you get to 500 points."
print
P = 100
fnr = function; return ceil(5*rnd); end function
while true
guess = input("Guess a number from 1 to 5: ").val
R = fnr
S = fnr
T = fnr
U = fnr
V = fnr
if guess == R then
P = P - 5
else if guess == S then
P = P + 5
else if guess == T then
P = P+P
print "You hit the jackpot!!!"
else if guess == U then
P = P + 1
else if guess == V then
P = P - floor(P*0.5)
else if guess > 5 then
continue
end if
if P > 500 then
print "!!!!You win!!!! with " + P + " points."
exit
end if
print "You have " + P + " points."; print
end while

View File

@@ -15,4 +15,4 @@ http://www.vintage-basic.net/games.html
#### Porting Notes
(please note any difficulties or challenges in porting here)
Contrary to the description, the computer picks *five* random numbers per turn, not one. You are not rewarded based on how close your guess is to one number, but rather to which of these five random numbers (if any) it happens to match exactly.