mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
Added MiniScript version of 18_Bullseye.
This commit is contained in:
19
00_Alternate_Languages/18_Bullseye/MiniScript/README.md
Normal file
19
00_Alternate_Languages/18_Bullseye/MiniScript/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
|
||||
|
||||
Conversion to [MiniScript](https://miniscript.org).
|
||||
|
||||
Ways to play:
|
||||
|
||||
0. Try-It! Page:
|
||||
Go to https://miniscript.org/tryit/, clear the sample code from the code editor, and paste in the contents of bullseye.ms. Then click the "Run Script" button. Program output (and input) will appear in the green-on-black terminal display to the right of or below the code editor.
|
||||
|
||||
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 bullseye.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 "bullseye"
|
||||
run
|
||||
59
00_Alternate_Languages/18_Bullseye/MiniScript/bullseye.ms
Normal file
59
00_Alternate_Languages/18_Bullseye/MiniScript/bullseye.ms
Normal file
@@ -0,0 +1,59 @@
|
||||
print " "*32 + "Bullseye"
|
||||
print " "*15 + "Creative Computing Morristown, New Jersey"
|
||||
print; print; print
|
||||
|
||||
print "In this game, up to 20 players throw darts at a target"
|
||||
print "with 10, 20, 30, and 40 point zones. the objective is"
|
||||
print "to get 200 points."; print
|
||||
print "throw description probable score"
|
||||
print " 1 fast overarm bullseye or complete miss"
|
||||
print " 2 controlled overarm 10, 20 or 30 points"
|
||||
print " 3 underarm anything";print
|
||||
names = []
|
||||
n = input("How many players? ").val; print
|
||||
for i in range(0, n-1)
|
||||
names.push input("Name of player #" + (i+1) + "? ")
|
||||
end for
|
||||
scores = [0] * n
|
||||
|
||||
round = 0
|
||||
while true
|
||||
round += 1; print; print "round " + round; print "---------"
|
||||
for i in range(0, n-1)
|
||||
while true
|
||||
print; t = input(names[i] + "'s throw? ").val
|
||||
if 1 <= t <= 3 then break
|
||||
print "Input 1, 2, or 3!"
|
||||
end while
|
||||
if t == 1 then
|
||||
p1=.65; p2=.55; p3=.5; p4=.5
|
||||
else if t == 2 then
|
||||
p1=.99; p2=.77; p3=.43; p4=.01
|
||||
else
|
||||
p1=.95; p2=.75; p3=.45; p4=.05
|
||||
end if
|
||||
u = rnd
|
||||
if u>=p1 then
|
||||
print "Bullseye!! 40 points!"; b=40
|
||||
else if u>=p2 then
|
||||
print "30-point zone!"; b=30
|
||||
else if u>=p3 then
|
||||
print "20-point zone"; b=20
|
||||
else if u>=p4 then
|
||||
print "Whew! 10 points."; b=10
|
||||
else
|
||||
print "Missed the target! too bad."; b=0
|
||||
end if
|
||||
scores[i] += b; print "Total score = " + scores[i]
|
||||
end for
|
||||
winners = []
|
||||
for i in range(0, n-1)
|
||||
if scores[i] >= 200 then winners.push i
|
||||
end for
|
||||
if winners then break
|
||||
end while
|
||||
|
||||
print; print "We have a winner!!"; print
|
||||
for i in winners; print names[i] + " scored " + scores[i] + " points."; end for
|
||||
print; print "Thanks for the game."
|
||||
|
||||
Reference in New Issue
Block a user