From 4f13cc39b0e945bb43742fe0b50a375dfcbd3951 Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Thu, 20 Jul 2023 07:14:41 -0700 Subject: [PATCH 01/12] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed typo (“it’s” —> “its”). --- 11_Bombardment/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/11_Bombardment/README.md b/11_Bombardment/README.md index d0d05bf9..de2a69e7 100644 --- a/11_Bombardment/README.md +++ b/11_Bombardment/README.md @@ -2,7 +2,7 @@ BOMBARDMENT is played on two, 5x5 grids or boards with 25 outpost locations numbered 1 to 25. Both you and the computer have four platoons of troops that can be located at any four outposts on your respective grids. -At the start of the game, you locate (or hide) your four platoons on your grid. The computer does the same on it’s grid. You then take turns firing missiles or bombs at each other’s outposts trying to destroy all four platoons. The one who finds all four opponents’ platoons first, wins. +At the start of the game, you locate (or hide) your four platoons on your grid. The computer does the same on its grid. You then take turns firing missiles or bombs at each other’s outposts trying to destroy all four platoons. The one who finds all four opponents’ platoons first, wins. This program was slightly modified from the original written by Martin Burdash of Parlin, New Jersey. From 8647d74a392dd1eb3369dd9749aeb4c415f883c6 Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Thu, 20 Jul 2023 07:29:12 -0700 Subject: [PATCH 02/12] Update README.md Added one known bug and one porting note. --- 11_Bombardment/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/11_Bombardment/README.md b/11_Bombardment/README.md index de2a69e7..d4bd08d7 100644 --- a/11_Bombardment/README.md +++ b/11_Bombardment/README.md @@ -15,6 +15,12 @@ As published in Basic Computer Games (1978): Downloaded from Vintage Basic at http://www.vintage-basic.net/games.html +#### Known Bugs + +- Though the instructions say you can't place two platoons on the same outpost, the code does not enforce this. So the player can "cheat" and guarantee a win by entering the same outpost number two or more times. + #### Porting Notes +- To ensure the instructions don't scroll off the top of the screen, we may want to insert a "(Press Return)" or similar prompt before printing the tear-off matrix. + (please note any difficulties or challenges in porting here) From 63af1a106676a5f65c90d6f623fe315d5a536170 Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Thu, 20 Jul 2023 15:15:02 -0700 Subject: [PATCH 03/12] Added MiniScript implementation of Bombardment and Bombs Away. Also fixed a minor issue with Blackjack. --- .../10_Blackjack/MiniScript/blackjack.ms | 24 ++-- .../11_Bombardment/MiniScript/README.md | 16 +++ .../11_Bombardment/MiniScript/bombardment.ms | 101 ++++++++++++++++ .../12_Bombs_Away/MiniScript/README.md | 16 +++ .../12_Bombs_Away/MiniScript/bombsaway.ms | 112 ++++++++++++++++++ 10_Blackjack/README.md | 1 + 12_Bombs_Away/README.md | 4 + 7 files changed, 265 insertions(+), 9 deletions(-) create mode 100644 00_Alternate_Languages/11_Bombardment/MiniScript/README.md create mode 100644 00_Alternate_Languages/11_Bombardment/MiniScript/bombardment.ms create mode 100644 00_Alternate_Languages/12_Bombs_Away/MiniScript/README.md create mode 100644 00_Alternate_Languages/12_Bombs_Away/MiniScript/bombsaway.ms diff --git a/00_Alternate_Languages/10_Blackjack/MiniScript/blackjack.ms b/00_Alternate_Languages/10_Blackjack/MiniScript/blackjack.ms index 6c44cf7c..f6d7959b 100644 --- a/00_Alternate_Languages/10_Blackjack/MiniScript/blackjack.ms +++ b/00_Alternate_Languages/10_Blackjack/MiniScript/blackjack.ms @@ -11,6 +11,8 @@ playerMoney = [0]*8 // total $ for each player (T) roundWinnings = [0]*7 // total $ won/lost this hand for each player (S) betPerHand = [0]*15 // bet for each hand (B) +cardNames = " A 2 3 4 5 6 7 8 9 10 J Q K".split + reshuffle = function print "Reshuffling" globals.deck = range(1,13)*4 @@ -23,6 +25,12 @@ getCard = function return deck.pop end function +// Function to get a name for the given card, preceded by "a" or "an" +a = function(cardNum) + article = "a" + "n" * (cardNum == 1 or cardNum == 8) + return article + " " + cardNames[cardNum] +end function + // Function to evaluate the given hand. Total is usually put into // handValue(handNum). Totals have the following meaning: // 2-10...Hard 2-10 @@ -123,7 +131,7 @@ playOneRound = function // Test for dealer blackjack if (dealerCard0==1 and dealerCard1 > 9) or (dealerCard0 > 9 and dealerCard1==1) then - print; print "Dealer has a " + cardNames[dealerCard1] + " in the hole for Blackjack" + print; print "Dealer has " + a(dealerCard1) + " in the hole for Blackjack" for i in range(0, numPlayers) handValue[i] = evalHand(i) end for @@ -144,11 +152,11 @@ playOneRound = function if hands[i] or hands[i+8] then anyLeft = true end for if not anyLeft then - print "Dealer had a " + cardNames[hands[numPlayers][1]] + " concealed." + print "Dealer had " + a(hands[numPlayers][1]) + " concealed." else // Play dealer's hand. dispTotal = displayTotal(handValue[numPlayers]) - print "Dealer has a " + cardNames[hands[numPlayers][1]] + " concealed" + + print "Dealer has " + a(hands[numPlayers][1]) + " concealed" + " for a total of " + dispTotal + "." while handValue[numPlayers] > 0 and dispTotal <= 16 card = getCard @@ -187,7 +195,7 @@ playHand = function(handNum, prompt=null, allowSplit=true) handValue[handNum] = evalHand(handNum) if choice == "D" then betPerHand[handNum] *= 2 card = getCard - print "Received a " + cardNames[card], " " + print "Received " + a(card), " " hands[handNum].push card handValue[handNum] = evalHand(handNum) if handValue[handNum] < 0 then @@ -209,10 +217,10 @@ playHand = function(handNum, prompt=null, allowSplit=true) hands[hand2] = [hands[handNum].pop] betPerHand[hand2] = betPerHand[handNum] card = getCard - print "First hand receives a " + cardNames[card] + print "First hand receives " + a(card) hands[handNum].push card card = getCard - print "Second hand receives a " + cardNames[card] + print "Second hand receives " + a(card) hands[hand2].push card if card1 != 1 then // Now play the two hands @@ -252,9 +260,7 @@ tallyResults = function print end function -// Main program starts here // (Line 1500) -// Initialize -cardNames = "n A 2 3 4 5 6 7 8 9 10 J Q K".split +// Main program starts here if getYesNo("Do you want instructions? ") == "Y" then print "This is the game of 21. As many as 7 players may play the" diff --git a/00_Alternate_Languages/11_Bombardment/MiniScript/README.md b/00_Alternate_Languages/11_Bombardment/MiniScript/README.md new file mode 100644 index 00000000..1db2e68d --- /dev/null +++ b/00_Alternate_Languages/11_Bombardment/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 bombardment.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 "bombardment" + run diff --git a/00_Alternate_Languages/11_Bombardment/MiniScript/bombardment.ms b/00_Alternate_Languages/11_Bombardment/MiniScript/bombardment.ms new file mode 100644 index 00000000..a6f75009 --- /dev/null +++ b/00_Alternate_Languages/11_Bombardment/MiniScript/bombardment.ms @@ -0,0 +1,101 @@ +print " "*33 + "Bombardment" +print " "*15 + "Creative Computing Morristown, New Jersey" +print; print; print +print "You are on a battlefield with 4 platoons and you" +print "have 25 outposts available where they may be placed." +print "You can only place one platoon at any one outpost." +print "The computer does the same with its four platoons." +print +print "The object of the game is to fire missiles at the" +print "outposts of the computer. It will do the same to you." +print "The one who destroys all four of the enemy's platoons" +print "first is the winner." +print +print "Good luck... and tell us where you want the bodies sent!" +print +input "(Press Return.)" // (so user can read the above) +print +print "Tear off matrix and use it to check off the numbers." +for i in range(1,5); print; end for +memory = [] // records computer's guesses +for row in range(1,5) + for i in range(row*5-4, row*5) + print (" " + i)[-6:], "" + end for + print +end for +print + +// Define a helper function to pick a random position (1-25) +// that is not already in the given list. +pickOutpost = function(excludingThese) + while true + pick = floor(rnd * 25) + 1 + if excludingThese.indexOf(pick) == null then return pick + end while +end function + +// Choose the computer's four positions. +computerOutposts = [] +for i in range(1,4) + computerOutposts.push pickOutpost(computerOutposts) +end for + +playerOutposts = [] +while playerOutposts.len != 4 + inp = input("What are your four positions? ") + inp = inp.replace(", ", " ").replace(",", " ") + inp = inp.split + for pos in inp + pos = pos.val + playerOutposts.push pos + if pos < 1 or pos > 25 then playerOutposts=[] + end for +end while + +// Main loop. +while true + // player's attack + pos = input("Where do you wish to fire your missile? ").val + if computerOutposts.indexOf(pos) == null then + print "Ha, ha you missed. My turn now:" + else + print "You got one of my outposts!" + computerOutposts.remove computerOutposts.indexOf(pos) + left = computerOutposts.len + if left == 3 then + print "One down, three to go." + else if left == 2 then + print "Two down, two to go." + else if left == 3 then + print "Three down, one to go." + else + print "You got me, I'm going fast. ButI'll get you when" + print "My transisto&s recup%ra*e!" + break + end if + end if + + // computer's attack + pos = pickOutpost(memory) + memory.push pos + if playerOutposts.indexOf(pos) == null then + print "I missed you, you dirty rat. I picked " + pos + ". Your turn:" + else + playerOutposts.remove playerOutposts.indexOf(pos) + left = playerOutposts.len + if left == 0 then + print "You're dead. Your last outpost was at " + pos + ". Ha, ha, ha." + print "Better luck next time." + break + end if + print "I got you. It won't be long now. Post " + pos + " was hit." + if left == 3 then + print "You have only three outposts left." + else if left == 2 then + print "You have only two outposts left." + else if left == 1 then + print "You have only one outpost left." + end if + end if +end while diff --git a/00_Alternate_Languages/12_Bombs_Away/MiniScript/README.md b/00_Alternate_Languages/12_Bombs_Away/MiniScript/README.md new file mode 100644 index 00000000..a654cb2a --- /dev/null +++ b/00_Alternate_Languages/12_Bombs_Away/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 bombsaway.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 "bombsaway" + run diff --git a/00_Alternate_Languages/12_Bombs_Away/MiniScript/bombsaway.ms b/00_Alternate_Languages/12_Bombs_Away/MiniScript/bombsaway.ms new file mode 100644 index 00000000..ea06ea48 --- /dev/null +++ b/00_Alternate_Languages/12_Bombs_Away/MiniScript/bombsaway.ms @@ -0,0 +1,112 @@ + +getNum = function(prompt, maxVal=5) + while true + num = floor(input(prompt + "? ").val) + if num > 0 and num <= maxVal then return num + print "Try again..." + end while +end function + +showReturn = function + print "You made it through tremendous flak!!" +end function + +showShotDown = function + print "* * * * boom * * * *" + print "You have been shot down....." + print "Dearly beloved, we are gathered here today to pay our" + print "last tribute..." +end function + +showSuccess = function + print "Direct hit!!!! " + floor(100*rnd) + " killed." + print "Mission successful." +end function + +// Function to calculate the mission result for all nations except Japan. +doNonJapanResult = function + print + d = input("How many missions have you flown? ").val + while d >= 160 + print "Missions, not miles..." + print "150 missions is high even for old-timers." + d = input("Now then, how many missions have you flown? ").val + end while + print + if d >= 100 then print "That's pushing the odds!" + if d < 25 then print "Fresh out of training, eh?" + print + if d >= 160 * rnd then + showSuccess + else + print "Missed target by " + floor(2+30*rnd) + " miles!" + print "Now you're really in for it !!"; print + r = getNum("Does the enemy have guns(1), missiles(2), or both(3)") + print + if r != 2 then + s = input("What's the percent hit rate of enemy gunners (10 to 50)? ").val + if s<10 then + print "You lie, but you'll pay..." + showShotDown + return + end if + end if + print + print + if r > 1 then t = 35 else t = 0 + if s + t > 100 * rnd then + showShotDown + else + showReturn + end if + end if +end function + +s = 0 // hit rate of enemy gunners +r = 0 // whether enemy has guns(1), missiles(2), or both(3) + +// Main Loop +while true + print "You are a pilot in a World War II bomber." + a = getNum("What side -- Italy(1), Allies(2), Japan(3), Germany(4)", 4) + + if a == 1 then // Italy + b = getNum("Your target -- Albania(1), Greece(2), North Africa(3)") + print + print ["Should be easy -- you're flying a nazi-made plane.", + "Be careful!!!", "You're going for the oil, eh?"][b-1] + doNonJapanResult + + else if a == 2 then // Allies + g = getNum("Aircraft -- Liberator(1), B-29(2), B-17(3), Lancaster(4)", 4) + print ["You've got 2 tons of bombs flying for Ploesti.", + "You're dumping the A-bomb on Hiroshima.", + "You're chasing the Aismark in the North Sea.", + "You're busting a German heavy water plant in the Ruhr."][g-1] + doNonJapanResult + + else if a == 3 then // Japan (different logic than all others) + print "You're flying a kamikaze mission over the USS Lexington." + isFirst = input("Your first kamikaze mission(y or n)? ").lower + if isFirst and isFirst[0] == "n" then + s = 0 + showReturn + else + print + if rnd > 0.65 then showSuccess else showShotDown + end if + + else // Germany + m = getNum("A nazi, eh? Oh well. Are you going for Russia(1)," + + char(13) + "England(2), or France(3)") + print ["You're nearing Stalingrad.", + "Nearing London. Be careful, they've got radar.", + "Nearing Versailles. Duck soup. They're nearly defenseless."][m-1] + doNonJapanResult + end if + + print; print; print; another = input("Another mission (y or n)? ").lower + if not another or another[0] != "y" then + print "Chicken !!!" ; print ; break + end if +end while diff --git a/10_Blackjack/README.md b/10_Blackjack/README.md index ebed2a88..66cfee65 100644 --- a/10_Blackjack/README.md +++ b/10_Blackjack/README.md @@ -19,6 +19,7 @@ http://www.vintage-basic.net/games.html #### Porting Notes The program makes extensive use of the assumption that a boolean expression evaluates to **-1** for true. This was the case in some classic BASIC environments but not others; and it is not the case in [JS Basic](https://troypress.com/wp-content/uploads/user/js-basic/index.html), leading to nonsensical results. In an environment that uses **1** instead of **-1** for truth, you would need to negate the boolean expression in the following lines: + - 10 - 570 - 590 - 2220 diff --git a/12_Bombs_Away/README.md b/12_Bombs_Away/README.md index 8a2decaa..603516fb 100644 --- a/12_Bombs_Away/README.md +++ b/12_Bombs_Away/README.md @@ -13,6 +13,10 @@ As published in Basic Computer Games (1978): Downloaded from Vintage Basic at http://www.vintage-basic.net/games.html +#### Known Bugs + +- If you play as Japan and say it is not your first mission, it is impossible to complete your mission; the only possible outcomes are "you made it through" or "boom". Moreover, the odds of each outcome depend on a variable (R) that is only set if you played a previous mission as a different side. It's possible this is an intentional layer of complexity meant to encourage repeat play, but it's more likely just a logical error. + #### Porting Notes (please note any difficulties or challenges in porting here) From 088226f316aee9a75c75d043e309ba80d09b9b44 Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Thu, 20 Jul 2023 16:27:32 -0700 Subject: [PATCH 04/12] Added MiniScript version of 13_Bounce. --- .../13_Bounce/MiniScript/README.md | 16 ++++++ .../13_Bounce/MiniScript/bounce.ms | 55 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 00_Alternate_Languages/13_Bounce/MiniScript/README.md create mode 100644 00_Alternate_Languages/13_Bounce/MiniScript/bounce.ms 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 From 52d58c8e751465968629235107bf90de7cc7c5df Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Thu, 20 Jul 2023 21:48:12 -0700 Subject: [PATCH 05/12] Implemented 14_Bowling for MiniScript. --- .../14_Bowling/MiniScript/README.md | 16 ++ .../14_Bowling/MiniScript/bowling.ms | 138 ++++++++++++++++++ 14_Bowling/README.md | 10 +- 3 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 00_Alternate_Languages/14_Bowling/MiniScript/README.md create mode 100644 00_Alternate_Languages/14_Bowling/MiniScript/bowling.ms diff --git a/00_Alternate_Languages/14_Bowling/MiniScript/README.md b/00_Alternate_Languages/14_Bowling/MiniScript/README.md new file mode 100644 index 00000000..8ac592e7 --- /dev/null +++ b/00_Alternate_Languages/14_Bowling/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 bowling.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 "bowling" + run diff --git a/00_Alternate_Languages/14_Bowling/MiniScript/bowling.ms b/00_Alternate_Languages/14_Bowling/MiniScript/bowling.ms new file mode 100644 index 00000000..139ec225 --- /dev/null +++ b/00_Alternate_Languages/14_Bowling/MiniScript/bowling.ms @@ -0,0 +1,138 @@ +import "listUtil" + +print " "*34 + "Bowl" +print " "*15 + "Creative Computing Morristown, New Jersey" +print; print; print + +pinDown = [0]*10 // state of each pin: 1=down, 0=standing +player = 1 +frame = 1 +ball = 1 +scores = list.init3d(10, 4, 3, 0) // index by [frame][player][ball], all 0-based + +printInstructions = function + print "The game of bowling takes mind and skill. During the game" + print "the computer will keep score. You may compete with" + print "other players [up to four]. You will be playing ten frames." + print "On the pin diagram 'O' means the pin is down...'+' means the" + print "pin is standing. After the game the computer will show your" + print "scores." +end function + +printPinDiagram = function + print "Player: " + (player+1) + " Frame: " + (frame+1) + " Ball: " + (ball+1) + print + k = 0 + for row in range (0, 3) + line = " " * row + for j in range(1, 4-row) + line += "+O"[pinDown[k]] + " " + k += 1 + end for + print line + end for +end function + +printAnalysis = function(previousDown=0) + pinsLeft = 10 - pinDown.sum + if pinDown.sum == previousDown then print "Gutter!!" + if ball == 0 and pinsLeft == 0 then + print "Strike!!!!!" + char(7)*4 + globals.status = 3 + else if ball == 1 and pinsLeft == 0 then + print "Spare!!!!" + globals.status = 2 + else if ball == 1 and pinsLeft > 0 then + print "Error!!!" // (i.e., didn't clear all the pins in 2 balls) + globals.status = 1 + end if +end function + +rollOneBall = function + print "Type roll to get the ball going." + input // (response ignored) + for i in range(1, 20) + // Generate a random number from 0-99, then take this mod 15. + // This gives us a slightly higher chance of hitting a non-existent + // pin than one of the actual 10. + x = floor(rnd*100) + if x % 15 < 10 then pinDown[x % 15] = 1 + end for + printPinDiagram +end function + +doOneFrame = function + globals.pinDown = [0]*10 + globals.ball = 0 + rollOneBall + printAnalysis + hitOnBall0 = pinDown.sum + scores[frame][player][ball] = hitOnBall0 + + globals.ball = 1 + if hitOnBall0 < 10 then + print "Roll your 2nd ball" + print + rollOneBall + printAnalysis hitOnBall0 + end if + // Note: scoring in this program is not like real bowling. + // It just stores the number of pins down at the end of each ball, + // and a status code (1, 2, or 3). + scores[frame][player][ball] = pinDown.sum + scores[frame][player][2] = status +end function + +pad = function(n, width=3) + return (" "*width + n)[-width:] +end function + +printFinalScores = function + print "FRAMES" + for i in range(1,10) + print pad(i), "" + end for + print + for player in range(0, numPlayers-1) + for i in range(0, 2) + for frame in range(0, 9) + print pad(scores[frame][player][i]), "" + end for + print + end for + print + end for +end function + +playOneGame = function + for f in range(0, 9) + globals.frame = f + for p in range(0, numPlayers-1) + globals.player = p + doOneFrame + end for + end for + print + printFinalScores +end function + +// Main program +print "Welcome to the alley" +print "Bring your friends" +print "Okay let's first get acquainted" +print +ans = input("The instructions (Y/N)? ").upper +if not ans or ans[0] != "N" then printInstructions +while true + numPlayers = input("First of all...How many are playing? ").val + if 0 < numPlayers < 5 then break + print "Please enter a number from 1 to 4." +end while +print +print "Very good..." +while true + playOneGame + print + ans = input("Do you want another game? ").upper + if not ans or ans[0] != "Y" then break +end while diff --git a/14_Bowling/README.md b/14_Bowling/README.md index d5492077..52a0ab44 100644 --- a/14_Bowling/README.md +++ b/14_Bowling/README.md @@ -17,6 +17,14 @@ As published in Basic Computer Games (1978): Downloaded from Vintage Basic at http://www.vintage-basic.net/games.html +#### Known Bugs + +- In the original code, scores is not kept accurately in multiplayer games. It stores scores in F*P, where F is the frame and P is the player. So, for example, frame 8 player 1 (index 16) clobbers the score from frame 4 player 2 (also index 16). + +- Even when scores are kept accurately, they don't match normal bowling rules. In this game, the score for each ball is just the total number of pins down after that ball, and the third row of scores is a status indicator (3 for strike, 2 for spare, 1 for anything else). + +- The program crashes with a "NEXT without FOR" error if you elect to play again after the first game. + #### Porting Notes -(please note any difficulties or challenges in porting here) +- The funny control characters in the "STRIKE!" string literal are there to make the terminal beep. From 73137781aacf0708e5cc6816cc1e142b320360e6 Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Sun, 23 Jul 2023 21:30:37 -0700 Subject: [PATCH 06/12] Added MiniScript version of 15_Boxing. --- .../15_Boxing/MiniScript/README.md | 16 ++ .../15_Boxing/MiniScript/boxing.ms | 174 ++++++++++++++++++ 15_Boxing/README.md | 10 +- 3 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 00_Alternate_Languages/15_Boxing/MiniScript/README.md create mode 100644 00_Alternate_Languages/15_Boxing/MiniScript/boxing.ms diff --git a/00_Alternate_Languages/15_Boxing/MiniScript/README.md b/00_Alternate_Languages/15_Boxing/MiniScript/README.md new file mode 100644 index 00000000..0904fdae --- /dev/null +++ b/00_Alternate_Languages/15_Boxing/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 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 diff --git a/00_Alternate_Languages/15_Boxing/MiniScript/boxing.ms b/00_Alternate_Languages/15_Boxing/MiniScript/boxing.ms new file mode 100644 index 00000000..948a3bdd --- /dev/null +++ b/00_Alternate_Languages/15_Boxing/MiniScript/boxing.ms @@ -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 diff --git a/15_Boxing/README.md b/15_Boxing/README.md index 12ecab4f..f0e6692d 100644 --- a/15_Boxing/README.md +++ b/15_Boxing/README.md @@ -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 man’s 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) From 7ed81c1496e11041074e09d3b6f27a7457e7c185 Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Mon, 24 Jul 2023 16:41:22 -0700 Subject: [PATCH 07/12] Added MiniScript version of 16_Bug. --- .../16_Bug/MiniScript/README.md | 16 ++ .../16_Bug/MiniScript/bug.ms | 192 ++++++++++++++++++ 2 files changed, 208 insertions(+) create mode 100644 00_Alternate_Languages/16_Bug/MiniScript/README.md create mode 100644 00_Alternate_Languages/16_Bug/MiniScript/bug.ms diff --git a/00_Alternate_Languages/16_Bug/MiniScript/README.md b/00_Alternate_Languages/16_Bug/MiniScript/README.md new file mode 100644 index 00000000..d668b53e --- /dev/null +++ b/00_Alternate_Languages/16_Bug/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 bug.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 "bug" + run diff --git a/00_Alternate_Languages/16_Bug/MiniScript/bug.ms b/00_Alternate_Languages/16_Bug/MiniScript/bug.ms new file mode 100644 index 00000000..29349b2a --- /dev/null +++ b/00_Alternate_Languages/16_Bug/MiniScript/bug.ms @@ -0,0 +1,192 @@ +print " "*34 + "Bug" +print " "*15 + "Creative Computing Morristown, New Jersey" +print; print; print +print "The game Bug" +print "I hope you enjoy this game." +print +ans = input("Do you want instructions? ").lower +if not ans or ans[0] != "n" then + print "The object of bug is to finish your bug before i finish" + print "mine. Each number stands for a part of the bug body." + print "I will roll the die for you, tell you what i rolled for you" + print "what the number stands for, and if you can get the part." + print "If you can get the part I will give it to you." + print "The same will happen on my turn." + print "If there is a change in either bug I will give you the" + print "option of seeing the pictures of the bugs." + print "Ihe numbers stand for parts as follows:" + print "Number Part Number of part needed" + print "1 body 1" + print "2 neck 1" + print "3 head 1" + print "4 feelers 2" + print "5 tail 1" + print "6 legs 6" + print + input "(Press Return.)" // (wait before starting the game) + print +end if + +// define a class to represent a bug (with all its body parts) +Bug = {} +Bug.body = false +Bug.neck = false +Bug.head = false +Bug.feelers = 0 +Bug.tail = false +Bug.legs = 0 +Bug.feelerLetter = "F" +Bug.pronoun = "I" + +// add a method to determine if the bug is complete +Bug.complete = function + return self.tail and self.feelers >= 2 and self.legs >= 6 +end function + +// add a method to draw the bug using print +Bug.draw = function + if self.feelers then + for row in range(1,4) + print " "*10 + (self.feelerLetter + " ") * self.feelers + end for + end if + if self.head then + print " HHHHHHH" + print " H H" + print " H O O H" + print " H H" + print " H V H" + print " HHHHHHH" + end if + if self.neck then + print " N N" + print " N N" + end if + if self.body then + print " BBBBBBBBBBBB" + print " B B" + print " B B" + if self.tail then print "TTTTTB B" + print " BBBBBBBBBBBB" + end if + if self.legs then + for row in [1,2] + print " "*5 + "L " * self.legs + end for + end if +end function + +// add a method to add a part, if possible; return true if bug changed +Bug.addPart = function(partNum) + if partNum == 1 then + print "1=Body" + if self.body then + print self.pronoun + " do not need a body." + else + print self.pronoun + " now have a body." + self.body = true + return true + end if + else if partNum == 2 then + print "2=neck" + if self.neck then + print self.pronoun + " do not need a neck." + else if not self.body then + print self.pronoun + " do not have a body." + else + print self.pronoun + " now have a neck." + self.neck = true + return true + end if + else if partNum == 3 then + print "3=head" + if self.head then + print self.pronoun + " have a head." + else if not self.neck then + print self.pronoun + " do not have a neck." + else + print self.pronoun + " needed a head." + self.head = true + return true + end if + else if partNum == 4 then + print "4=feelers" + if self.feelers >= 2 then + print self.pronoun + " have two feelers already." + else if not self.head then + print self.pronoun + " do not have a head." + else + if self.pronoun == "You" then + print "I now give you a feeler." + else + print "I get a feeler." + end if + self.feelers += 1 + return true + end if + else if partNum == 5 then + print "5=tail" + if self.tail then + print self.pronoun + " already have a tail." + else if not self.body then + print self.pronoun + " do not have a body." + else + if self.pronoun == "You" then + print "I now give you a tail." + else + print "I now have a tail." + end if + self.tail = true + return true + end if + else if partNum == 6 then + print "6=legs" + if self.legs >= 6 then + print self.pronoun + " have 6 feet." + else if not self.body then + print self.pronoun + " do not have a body." + else + self.legs += 1 + print self.pronoun + " now have " + self.legs + " leg" + "s"*(self.legs>1) + "." + return true + end if + end if + return 0 +end function + + +// ...then, instantiate a bug for You (human player) and Me (computer) +you = new Bug +you.feelerLetter = "A" // (don't ask me why) +you.pronoun = "You" +me = new Bug + +// Main loop +while not you.complete and not me.complete + anyChange = false + die = floor(6 * rnd + 1) + print; print "You rolled a " + die + if you.addPart(die) then anyChange = true + wait 2 + die = floor(6 * rnd + 1) + print; print "I rolled a " + die + if me.addPart(die) then anyChange = true + if you.complete then print "Your bug is finished." + if me.complete then print "My bug is finished." + if anyChange then + ans = input("Do you want the pictures? ").lower + if not ans or ans[0] != "n" then + print "*****Your Bug*****" + print; print + you.draw + wait 2 + print + print "*****My Bug*****" + print; print + me.draw + wait 2 + end if + end if +end while +print "I hope you enjoyed the game, play it again soon!!" + From 8442755142d60520aab308731d080941bddda73f Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Tue, 25 Jul 2023 09:08:00 -0700 Subject: [PATCH 08/12] Added MiniScript version of 17_Bullfight. --- .../17_Bullfight/MiniScript/README.md | 16 ++ .../17_Bullfight/MiniScript/bull.ms | 188 ++++++++++++++++++ 17_Bullfight/README.md | 4 +- 3 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 00_Alternate_Languages/17_Bullfight/MiniScript/README.md create mode 100644 00_Alternate_Languages/17_Bullfight/MiniScript/bull.ms diff --git a/00_Alternate_Languages/17_Bullfight/MiniScript/README.md b/00_Alternate_Languages/17_Bullfight/MiniScript/README.md new file mode 100644 index 00000000..d791a463 --- /dev/null +++ b/00_Alternate_Languages/17_Bullfight/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 bull.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 "bull" + run diff --git a/00_Alternate_Languages/17_Bullfight/MiniScript/bull.ms b/00_Alternate_Languages/17_Bullfight/MiniScript/bull.ms new file mode 100644 index 00000000..1259d651 --- /dev/null +++ b/00_Alternate_Languages/17_Bullfight/MiniScript/bull.ms @@ -0,0 +1,188 @@ +print " "*34 + "Bull" +print " "*15 + "Creative Computing Morristown, New Jersey" +print; print; print + +getYesNo = function(prompt) + while true + ans = input(prompt + "? ").lower + if ans and (ans[0] == "y" or ans[0] == "n") then return ans[0] + print "Incorrect answer - - please type 'yes' or 'no'." + end while +end function + +if getYesNo("Do you want instructions") == "y" then + print "Hello, all you bloodlovers and aficionados." + print "Here is your big chance to kill a bull." + print + print "On each pass of the bull, you may try" + print "0 - Veronica (dangerous inside move of the cape)" + print "1 - Less dangerous outside move of the cape" + print "2 - Ordinary swirl of the cape." + print + print "Instead of the above, you may try to kill the bull" + print "on any turn: 4 (over the horns), 5 (in the chest)." + print "But if I were you," + print "I wouldn't try it before the seventh pass." + print + print "The crowd will determine what award you deserve" + print "(posthumously if necessary)." + print "The braver you are, the better the award you receive." + print + print "The better the job the picadores and toreadores do," + print "the better your chances are." + print; input "(Press return.)" +end if +print; print +bravery = 1 +outcome = 1 +qualities = [null, "superb", "good", "fair", "poor", "awful"] + +// Select a bull (level 1-5, lower numbers are tougher) +bullLevel = floor(rnd*5+1) +print "You have drawn a " + qualities[bullLevel] + " bull." +if bullLevel > 4 then print "You're lucky." +if bullLevel < 2 then print "Good luck. You'll need it." +print + +// Simulate one of the preliminary types of bullfighters +// (picodores or toreadores). Return their effect, 0.1 - 0.5. +simPreliminary = function(fighterType) + effect = 0.1 + temp = 3 / bullLevel * rnd + if temp < 0.87 then effect = 0.2 + if temp < 0.63 then effect = 0.3 + if temp < 0.5 then effect = 0.4 + if temp < 0.37 then effect = 0.5 + t = floor(10 * effect + 0.2) // (get quality in range 1 - 5) + print "The " + fighterType + " did a " + qualities[t] + " job." + if t == 5 then + if fighterType == "picadores" then + print floor(rnd*2+1) + " of the horses of the picadores killed." + end if + print floor(rnd*2+1) + " of the " + fighterType + " killed." + else if t == 4 then + if rnd > 0.5 then + print "One of the " + fighterType + " killed." + else + print "No " + fighterType + " were killed." + end if + end if + print + return effect +end function + +picaEffect = simPreliminary("picadores") +toreEffect = simPreliminary("toreadores") + +getGored = function + while not done + if rnd > 0.5 then + print "You are dead." + globals.bravery = 1.5 + globals.done = true + else + print "You are still alive."; print + if getYesNo("Do you run from the ring") == "y" then + print "Coward" + globals.bravery = 0 + globals.done = true + else + print "You are brave. Stupid, but brave." + if rnd > 0.5 then + globals.bravery = 2 + break + else + print "You are gored again!" + end if + end if + end if + end while +end function + +pass = 0 +courage = 1 // cumulative effect of cape choices +bravery = 1 // set mainly by outcomes after getting gored +victory = false // true if we kill the bull +done = false + +while not done + pass += 1 + print + print "Pass number " + pass + if pass < 3 then + print "The bull is charging at you! You are the matador--" + tryKill = (getYesNo("do you want to kill the bull") == "y") + else + tryKill = (getYesNo("Here comes the bull. Try for a kill") == "y") + end if + if tryKill then + print; print "It is the moment of truth."; print + h = input("How do you try to kill the bull? " ).val + if h != 4 and h != 5 then + print "You panicked. The bull gored you." + getGored + break + end if + k = (6-bullLevel) * 10 * rnd / ((picaEffect + toreEffect) * 5 * pass) + if h == 4 then + victory = (k <= 0.8) + else + victory = (k <= 0.2) + end if + if victory then + print "You killed the bull!" + else + print "The bull has gored you!" + getGored + end if + done = true + else + if pass < 3 then + capeMove = input("What move do you make with the cape? ").val + else + capeMove = input("Cape move? ").val + end if + while capeMove < 0 or capeMove > 2 or capeMove != floor(capeMove) + print "Don't panic, you idiot! Put down a correct number" + capeMove = input.val + end while + m = [3, 2, 0.5][capeMove] + courage += m + f = (6-bullLevel+m/10)*rnd / ((picaEffect+toreEffect+pass/10)*5) + if f >= 0.51 then + print "The bull has gored you!" + getGored + end if + end if +end while + +// Final outcome +if bravery == 0 then + print "The crowd boos for ten minutes. If you ever dare to show" + print "your face in a ring again, they swear they will kill you--" + print "unless the bull does first." +else + fnd = (4.5+courage/6-(picaEffect+toreEffect)*2.5+4*bravery+2*(victory+1)-pass^2/120-bullLevel) + fnc = function; return fnd * rnd; end function + if bravery == 2 then + print "The crowd cheers wildly!" + else if victory then + print "The crowd cheers!"; print + end if + print "The crowd awards you" + if fnc < 2.4 then + print "nothing at all." + else if fnc < 4.9 then + print "one ear of the bull." + else if fnc < 7.4 then + print "Both ears of the bull!" + print "Ole!" + else + print "Ole! You are 'Muy Hombre!"" Ole! Ole!" + end if +end if +print +print "Adios"; print; print; print + + + diff --git a/17_Bullfight/README.md b/17_Bullfight/README.md index c801b16e..b81aab0b 100644 --- a/17_Bullfight/README.md +++ b/17_Bullfight/README.md @@ -26,6 +26,6 @@ http://www.vintage-basic.net/games.html #### Porting Notes -(please note any difficulties or challenges in porting here) +- There is a fundamental assumption in the pre-fight subroutine at line 1610, that the Picadores and Toreadores are more likely to do a bad job (and possibly get killed) with a low-quality bull. This appears to be a mistake in the original code, but should be retained. -- There is a fundamental assumption in the pre-fight subroutine at line 1610, that the Picadores and Toreadores are more likely to do a bad job (and possibly get killed) with a low-quality bull. This appears to be a mistake in the original code, but should be retained. \ No newline at end of file +- Lines 1800-1820 (part of the pre-fight subroutine) can never be reached. From cbbf23d5b5b9f6714b557049117cc7c4e6382db2 Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Tue, 25 Jul 2023 09:24:42 -0700 Subject: [PATCH 09/12] Added MiniScript version of 18_Bullseye. --- .../18_Bullseye/MiniScript/README.md | 19 ++++++ .../18_Bullseye/MiniScript/bullseye.ms | 59 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 00_Alternate_Languages/18_Bullseye/MiniScript/README.md create mode 100644 00_Alternate_Languages/18_Bullseye/MiniScript/bullseye.ms diff --git a/00_Alternate_Languages/18_Bullseye/MiniScript/README.md b/00_Alternate_Languages/18_Bullseye/MiniScript/README.md new file mode 100644 index 00000000..2c353d26 --- /dev/null +++ b/00_Alternate_Languages/18_Bullseye/MiniScript/README.md @@ -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 diff --git a/00_Alternate_Languages/18_Bullseye/MiniScript/bullseye.ms b/00_Alternate_Languages/18_Bullseye/MiniScript/bullseye.ms new file mode 100644 index 00000000..10dc95ca --- /dev/null +++ b/00_Alternate_Languages/18_Bullseye/MiniScript/bullseye.ms @@ -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." + From 15e033e65c0d3dac0071d8a2f304387ef5e82cea Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Tue, 25 Jul 2023 10:32:13 -0700 Subject: [PATCH 10/12] Added MiniScript version of 19_Bunny. --- .../19_Bunny/MiniScript/README.md | 19 ++++++++ .../19_Bunny/MiniScript/bunny.ms | 43 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 00_Alternate_Languages/19_Bunny/MiniScript/README.md create mode 100644 00_Alternate_Languages/19_Bunny/MiniScript/bunny.ms diff --git a/00_Alternate_Languages/19_Bunny/MiniScript/README.md b/00_Alternate_Languages/19_Bunny/MiniScript/README.md new file mode 100644 index 00000000..96306605 --- /dev/null +++ b/00_Alternate_Languages/19_Bunny/MiniScript/README.md @@ -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 bunny.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 bunny.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 "bunny" + run diff --git a/00_Alternate_Languages/19_Bunny/MiniScript/bunny.ms b/00_Alternate_Languages/19_Bunny/MiniScript/bunny.ms new file mode 100644 index 00000000..176e1e6c --- /dev/null +++ b/00_Alternate_Languages/19_Bunny/MiniScript/bunny.ms @@ -0,0 +1,43 @@ +print " "*33 + "Bunny" +print " "*15 + "Creative Computing Morristown, New Jersey" +print; print; print + +data = [] +data += [1,2,-1,0,2,45,50,-1,0,5,43,52,-1,0,7,41,52,-1] +data += [1,9,37,50,-1,2,11,36,50,-1,3,13,34,49,-1,4,14,32,48,-1] +data += [5,15,31,47,-1,6,16,30,45,-1,7,17,29,44,-1,8,19,28,43,-1] +data += [9,20,27,41,-1,10,21,26,40,-1,11,22,25,38,-1,12,22,24,36,-1] +data += [13,34,-1,14,33,-1,15,31,-1,17,29,-1,18,27,-1] +data += [19,26,-1,16,28,-1,13,30,-1,11,31,-1,10,32,-1] +data += [8,33,-1,7,34,-1,6,13,16,34,-1,5,12,16,35,-1] +data += [4,12,16,35,-1,3,12,15,35,-1,2,35,-1,1,35,-1] +data += [2,34,-1,3,34,-1,4,33,-1,6,33,-1,10,32,34,34,-1] +data += [14,17,19,25,28,31,35,35,-1,15,19,23,30,36,36,-1] +data += [14,18,21,21,24,30,37,37,-1,13,18,23,29,33,38,-1] +data += [12,29,31,33,-1,11,13,17,17,19,19,22,22,24,31,-1] +data += [10,11,17,18,22,22,24,24,29,29,-1] +data += [22,23,26,29,-1,27,29,-1,28,29,-1,4096] + +string.pad = function(w) + return self + " " * (w - self.len) +end function + +for i in range(5); print; end for + +line = "" +while true + x = data.pull + if x > 128 then break + if x >= 0 then + line = line.pad(x) + y = data.pull + for i in range(x, y) + line += "BUNNY"[i % 5] + end for + else + print line + line = "" + wait 0.1 // optional delay to make printing more visible + end if +end while + From 8426a39c486f541cfb1e7e88a5b1570b1b29ecb6 Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Tue, 25 Jul 2023 13:17:14 -0700 Subject: [PATCH 11/12] Added MiniScript version of 20_Buzzword. --- .../20_Buzzword/MiniScript/README.md | 19 ++++++++++ .../20_Buzzword/MiniScript/buzzword.ms | 38 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 00_Alternate_Languages/20_Buzzword/MiniScript/README.md create mode 100644 00_Alternate_Languages/20_Buzzword/MiniScript/buzzword.ms diff --git a/00_Alternate_Languages/20_Buzzword/MiniScript/README.md b/00_Alternate_Languages/20_Buzzword/MiniScript/README.md new file mode 100644 index 00000000..96306605 --- /dev/null +++ b/00_Alternate_Languages/20_Buzzword/MiniScript/README.md @@ -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 bunny.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 bunny.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 "bunny" + run diff --git a/00_Alternate_Languages/20_Buzzword/MiniScript/buzzword.ms b/00_Alternate_Languages/20_Buzzword/MiniScript/buzzword.ms new file mode 100644 index 00000000..26a37775 --- /dev/null +++ b/00_Alternate_Languages/20_Buzzword/MiniScript/buzzword.ms @@ -0,0 +1,38 @@ +print " "*26 + "Buzzword Generator" +print " "*15 + "Creative Computing Morristown, New Jersey" +print; print; print + +print "This program prints highly acceptable phrases in" +print "'educator-speak' that you can work into reports" +print "and speeches. Whenever a question mark is printed," +print "type a 'y' for another phrase or 'n' to quit." + +words1 = ["ability","basal","behavioral","child-centered", + "differentiated","discovery","flexible","heterogeneous", + "homogeneous","manipulative","modular","tavistock", + "individualized"] + +words2 = ["learning", "evaluative","objective", + "cognitive","enrichment","scheduling","humanistic", + "integrated","non-graded","training","vertical age", + "motivational","creative"] + +words3 = ["grouping","modification", + "accountability","process","core curriculum","algorithm", + "performance","reinforcement","open classroom","resource", + "structure","facility","environment"] + +list.any = function + return self[self.len * rnd] +end function + +print; print; print "Here's the first phrase:" + +while true + print [words1.any, words2.any, words3.any].join + print + yn = input("?").lower + if yn != "y" then break +end while + +print "Come back when you need help with another report!" From 6a611c04d7b30300a11812e0237d6608b3fed7ab Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Tue, 25 Jul 2023 17:27:50 -0700 Subject: [PATCH 12/12] Added MiniScript version of 21_Calendar. --- .../21_Calendar/MiniScript/README.md | 16 ++++ .../21_Calendar/MiniScript/calendar.ms | 89 +++++++++++++++++++ 21_Calendar/README.md | 4 +- 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 00_Alternate_Languages/21_Calendar/MiniScript/README.md create mode 100644 00_Alternate_Languages/21_Calendar/MiniScript/calendar.ms diff --git a/00_Alternate_Languages/21_Calendar/MiniScript/README.md b/00_Alternate_Languages/21_Calendar/MiniScript/README.md new file mode 100644 index 00000000..6d7f8ca5 --- /dev/null +++ b/00_Alternate_Languages/21_Calendar/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 calendar.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 "calendar" + run diff --git a/00_Alternate_Languages/21_Calendar/MiniScript/calendar.ms b/00_Alternate_Languages/21_Calendar/MiniScript/calendar.ms new file mode 100644 index 00000000..27691bdb --- /dev/null +++ b/00_Alternate_Languages/21_Calendar/MiniScript/calendar.ms @@ -0,0 +1,89 @@ +import "stringUtil" + +print " "*32 + "Calendar" +print " "*15 + "Creative Computing Morristown, New Jersey" +print; print; print + +startingDOW = 0 +leapYear = false + +// Note: while the original program required changes to the code to configure +// it for the current year, in this port we choose to ask the user. +// Here's the function to do that. +getParameters = function + days = "sunday monday tuesday wednesday thursday friday saturday".split + globals.startingDOW = 999 + while startingDOW == 999 + ans = input("What is the first day of the week of the year? ").lower + if not ans then continue + for i in days.indexes + if days[i].startsWith(ans) then + globals.startingDOW = -i + break + end if + end for + end while + + while true + ans = input("Is it a leap year? ").lower + if ans and (ans[0] == "y" or ans[0] == "n") then break + end while + globals.leapYear = (ans[0] == "y") + + while true + ans = input("Pause after each month? ").lower + if ans and (ans[0] == "y" or ans[0] == "n") then break + end while + globals.pause = (ans[0] == "y") +end function + +getParameters +monthNames = [ + " JANUARY ", + " FEBRUARY", + " MARCH ", + " APRIL ", + " MAY ", + " JUNE ", + " JULY ", + " AUGUST ", + "SEPTEMBER", + " OCTOBER ", + " NOVEMBER", + " DECEMBER", + ] +monthDays = [31, 28 + leapYear, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + +// Function to print one month calendar. +// month: numeric month number, 0-based (0-11) +printMonth = function(month) + daysSoFar = monthDays[:month].sum + daysLeft = monthDays[month:].sum + print "** " + str(daysSoFar).pad(4) + "*"*18 + " " + monthNames[month] + + " " + "*"*18 + " " + str(daysLeft).pad(4) + "**" + print + print " S M T W T F S" + print + print "*" * 61 + // calculate the day of the week, from 0=Sunday to 6=Saturday + dow = (daysSoFar - startingDOW) % 7 + print " " * 5 + " " * (8*dow), "" + for i in range(1, monthDays[month]) + print str(i).pad(8), "" + dow += 1 + if dow == 7 then + dow = 0 + print + if i == monthDays[month] then break + print; print " " * 5, "" + end if + end for + print +end function + +// Main loop. +for month in range(0, 11) + printMonth month + print + if month < 11 and pause then input +end for diff --git a/21_Calendar/README.md b/21_Calendar/README.md index 05c3ab96..5f5b04ea 100644 --- a/21_Calendar/README.md +++ b/21_Calendar/README.md @@ -24,4 +24,6 @@ http://www.vintage-basic.net/games.html #### Porting Notes -(please note any difficulties or challenges in porting here) +- While many modern environments have time/date functions that would make this program both easier and more automatic, in these ports we are choosing to do without them, as in the original program. + +- Some ports choose to ask the user the starting day of week, and whether it's a leap year, rather than force changes to the code to fit the desired year.