Added MiniScript port of 52_Kinema

This commit is contained in:
JoeStrout
2023-01-28 18:41:49 -07:00
parent 2c42d39bfd
commit 921a03f9e2
2 changed files with 43 additions and 0 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,40 @@
// Kinema
//
// Ported from BASIC to MiniScript by Joe Strout
print " "*33 + "KINEMA"
print " "*15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
print; print; print
checkAnswer = function(prompt, correctValue)
answer = input(prompt).val
right = abs((answer - correctValue)/answer) < 0.15
if right then
print "Close enough!"
else
print "Not even close...."
end if
print "Correct answer is " + correctValue
return right
end function
doOneRun = function
print; print
rightCount = 0
V = 5 + floor(35*rnd)
print "A ball is thrown upwards at " + V + " meters per second."
print
rightCount += checkAnswer("How high will it go (in meters)? ", 0.05 * V^2)
rightCount += checkAnswer("How long until it returns (in seconds)? ", V/5)
t = 1 + floor(2*V*rnd)/10
rightCount += checkAnswer("What will its velocity be after " + t +
" seconds? ", V-10*t)
print
print rightCount + " right out of 3."
if rightCount >= 2 then print " Not bad."
end function
// main loop (press control-C to break out)
while true
doOneRun
end while