diff --git a/00_Alternate_Languages/13_Bounce/MiniScript/README.md b/00_Alternate_Languages/13_Bounce/MiniScript/README.md new file mode 100644 index 00000000..22e4e41a --- /dev/null +++ b/00_Alternate_Languages/13_Bounce/MiniScript/README.md @@ -0,0 +1,16 @@ +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 bounce.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 BASIC program. Then, at the Mini Micro command prompt, enter: + + load "bounce" + run diff --git a/00_Alternate_Languages/13_Bounce/MiniScript/bounce.ms b/00_Alternate_Languages/13_Bounce/MiniScript/bounce.ms new file mode 100644 index 00000000..64174be6 --- /dev/null +++ b/00_Alternate_Languages/13_Bounce/MiniScript/bounce.ms @@ -0,0 +1,55 @@ +print " "*33 + "Bounce" +print " "*15 + "Creative Computing Morristown, New Jersey" +print; print; print +t = [0]*21 +print "This simulation lets you specify the initial velocity" +print "of a ball thrown straight up, and the coefficient of" +print "elasticity of the ball. Please use a decimal fraction" +print "coefficiency (less than 1)." +print +print "You also specify the time increment to be used in" +print "'strobing' the ball's flight (try .1 initially)." +print + +addToLine = function(line, tabPos, textToAdd) + return line + " " * (floor(tabPos) - line.len) + textToAdd +end function + +while true + s2 = input("Time increment (sec)? ").val + print + v = input("Velocity (fps)? ").val + print + c = input("Coefficient? ").val + print + print "feet" + print + s1 = floor(70/(v/(16*s2))) + for i in range(1, s1) + t[i]=v*c^(i-1)/16 + end for + for h in range(floor(-16*(v/32)^2+v^2/32+.5), 0, -0.5) + line = "" + if floor(h)==h then line = str(h) + l=0 + for i in range(1, s1) + for time in range(0, t[i], s2) + l=l+s2 + if abs(h-(.5*(-32)*time^2+v*c^(i-1)*time))<=.25 then + line = addToLine(line, l/s2, "0") + end if + end for + time = t[i+1]/2 + if -16*time^2+v*c^(i-1)*time < h then break + end for + print line + end for + print " " + "." * floor((l+1)/s2+1) + line = " 0" + for i in range(1, l+.9995) + line = addToLine(line, i/s2, i) + end for + print line + print " " * floor((l+1)/(2*s2)-2) + "seconds" + print +end while