Added MiniScript version of 15_Boxing.

This commit is contained in:
JoeStrout
2023-07-23 21:30:37 -07:00
parent 52d58c8e75
commit 73137781aa
3 changed files with 199 additions and 1 deletions

View File

@@ -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 boxing.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 "boxing"
run

View File

@@ -0,0 +1,174 @@
print " "*33 + "Boxing"
print " "*15 + "Creative Computing Morristown, New Jersey"
print; print; print
print "Boxing Olympic Style (3 Rounds -- 2 out of 3 Wins)"
playerWins = 0
opponentWins = 0
print
opponentName = input("What is your opponent's name? ")
playerName = input("Input your man's name? ")
print "Different punches are: (1) full swing; (2) hook; (3) uppercut; (4) jab."
playerBest = input("What is your man's best? ").val
playerWeakness = input("What is his vulnerability? " ).val
while true
opponentBest = floor(4 * rnd + 1)
opponentWeakness = floor(4 * rnd + 1)
if opponentBest != opponentWeakness then break
end while
print opponentName + "'s advantage is " + opponentBest + " and vulnerability is secret."
print
playerConnects = function
print "He connects!"
if playerPoints > 35 then
print opponentName + " is knocked cold and " + playerName + " is the winner and champ!"
globals.done = true
return
end if
globals.playerPoints += 15
end function
doPlayerPunch = function
p = input(playerName + "'s punch? ").val
if p == playerBest then globals.playerPoints += 2
if p == 1 then // Full Swing
print playerName + " swings and ", ""
if opponentWeakness == 4 then // (probably a bug in original code)
playerConnects
else
x3 = floor(30 * rnd+1)
if x3 < 10 then
playerConnects
else
print "he misses "
if playerPoints != 1 then
print
print
end if
end if
end if
else if p == 2 then // Hook
print playerName + " gives the hook... ", ""
if opponentWeakness == 2 then
globals.playerPoints += 7
else
h1 = floor(2 * rnd + 1)
if h1 == 1 then
print "But it's blocked!!!!!!!!!!!!!"
else
print "Connects..."
globals.playerPoints += 7
end if
end if
else if p == 3 then // Uppercut
print playerName + " tries an uppercut ", ""
if opponentWeakness == 3 or floor(100 * rnd + 1) < 51 then
print "and he connects!"
globals.playerPoints += 4
else
print "and it's blocked (lucky block!)"
end if
else // Jab
print playerName + " jabs at " + opponentName + "'s head ", ""
if opponentWeakness != 4 and floor(8 * rnd + 1) >= 4 then
print "It's blocked."
else
globals.playerPoints += 3
end if
end if
end function
playerKnockedOut = function
print playerName + " is knocked cold and " + opponentName + " is the winner and champ!"
globals.done = true
end function
doOpponentPunch = function
j7 = floor(4 * rnd + 1)
if j7 == playerBest then globals.opponentPoints += 2
if j7 == 1 then // Full swing
print opponentName + " takes a full swing and ", ""
if playerWeakness == 1 or floor(60 * rnd + 1) < 30 then
print "POW!!!!! He hits him right in the face!"
if opponentPoints > 35 then
playerKnockedOut
else
globals.opponentPoints += 15
end if
else
print "it's blocked!"
end if
end if
if j7 == 2 then // Hook
print opponentName + " gets " + playerName + " in the jaw (ouch!)"
globals.playerPoints += 7
print "....and again!"
globals.playerPoints += 5
if opponentPoints > 35 then
playerKnockedOut
return
end if
print
// continue below as if an Uppercut (probably a bug in the original code)
end if
if j7 == 2 or j7 == 3 then // Uppercut, or Hook
print playerName + " is attacked by an uppercut (oh,oh)..."
if playerWeakness == 3 or floor(200*rnd+1) <= 75 then
print "and " + opponentName + " connects..."
globals.opponentPoints += 8
else
print " blocks and hits " + opponentName + " with a hook."
globals.playerPoints += 5
end if
end if
if j7 == 4 then // Jab
print opponentName + " jabs and ", ""
if playerWeakness == 4 or floor(7 * rnd + 1) > 4 then
print "blood spills !!!"
globals.opponentPoints += 5
else
print "It's blocked!"
end if
end if
end function
playOneRound = function
globals.playerPoints = 0
globals.opponentPoints = 0
print "Round " + round + " begins..."
for r1 in range(1, 7)
i = floor(10 * rnd + 1)
if i <= 5 then
doPlayerPunch
else
doOpponentPunch
end if
if done then return
end for // next R1 (sub-round)
if playerPoints > opponentPoints then
print; print playerName + " wins round " + round
globals.playerWins += 1
else
print; print opponentName + " wins round " + round
globals.opponentWins += 1
end if
end function
done = false
for round in range(1,3)
playOneRound
if done then break
if opponentWins >= 2 then
print opponentName + " wins (nice going, " + opponentName + ")."
break
else if playerWins >= 2 then
print playerName + " amazingly wins!!"
break
end if
end for // next round
print
print
print "and now goodbye from the Olympic arena."
print

View File

@@ -2,7 +2,7 @@
This program simulates a three-round Olympic boxing match. The computer coaches one of the boxers and determines his punches and defences, while you do the same for your boxer. At the start of the match, you may specify your mans best punch and his vulnerability.
There are approximately seven major punches per round, although this may be varied. The best out if three rounds wins.
There are approximately seven major punches per round, although this may be varied. The best out of three rounds wins.
Jesse Lynch of St. Paul, Minnesota created this program.
@@ -15,6 +15,14 @@ As published in Basic Computer Games (1978):
Downloaded from Vintage Basic at
http://www.vintage-basic.net/games.html
#### Known Bugs
- The code that handles player punch type 1 checks for opponent weakness type 4; this is almost certainly a mistake.
- Line breaks or finishing messages are omitted in various cases. For example, if the player does a hook, and that's the opponent's weakness, then 7 points are silently awarded without outputting any description or line break, and the next sub-round will begin on the same line.
- When the opponent selects a hook, control flow falls through to the uppercut case. Perhaps related, a player weakness of type 2 (hook) never has any effect on the game.
#### Porting Notes
(please note any difficulties or challenges in porting here)