From 3bd8b2f614cac666d31ea8a05870ea312248648a Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Wed, 4 Oct 2023 15:12:39 -0700 Subject: [PATCH] Added MiniScript version of 80_Slots. --- .../80_Slots/MiniScript/README.md | 18 +++ .../80_Slots/MiniScript/slots.ms | 108 ++++++++++++++++++ 80_Slots/README.md | 4 + 3 files changed, 130 insertions(+) create mode 100644 00_Alternate_Languages/80_Slots/MiniScript/README.md create mode 100644 00_Alternate_Languages/80_Slots/MiniScript/slots.ms diff --git a/00_Alternate_Languages/80_Slots/MiniScript/README.md b/00_Alternate_Languages/80_Slots/MiniScript/README.md new file mode 100644 index 00000000..a8b56b3d --- /dev/null +++ b/00_Alternate_Languages/80_Slots/MiniScript/README.md @@ -0,0 +1,18 @@ +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 slots.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 MiniScript program and this README file. Then, at the Mini Micro command prompt, enter: +``` + load "slots" + run +``` diff --git a/00_Alternate_Languages/80_Slots/MiniScript/slots.ms b/00_Alternate_Languages/80_Slots/MiniScript/slots.ms new file mode 100644 index 00000000..310ff95e --- /dev/null +++ b/00_Alternate_Languages/80_Slots/MiniScript/slots.ms @@ -0,0 +1,108 @@ +print " "*30 + "Slots" +print " "*15 + "Creative Computing Morristown New Jersey" +print; print; print + +// PRODUCED BY FRED MIRABELLE AND BOB HARPER ON JAN 29, 1973 +// IT SIMULATES THE SLOT MACHINE. +// (Ported to MiniScript by Joe Strout on Oct 04, 2023) + +print "You are in the H&M casino,in front of one of our" +print "one-arm bandits. Bet from $1 to $100." +print "To pull the arm, punch the return key after making your bet." + +symbols = ["BAR", "BELL", "ORANGE", "LEMON", "PLUM", "CHERRY"] + + +winTriple = function(symbol, bet) + if symbol == "BAR" then + print "***JACKPOT***" + globals.profit += 101 * bet + else + print "**TOP DOLLAR**" + globals.profit += 11 * bet + end if + print "You won!" +end function + +winDouble = function(symbol, bet) + if symbol == "BAR" then + print "*DOUBLE BAR*" + globals.profit += 6 * bet + else + print "Double!" + globals.profit += 3 * bet + end if + print "You won!" +end function + +lose = function(bet) + print "You lost." + globals.profit -= bet +end function + +calcWinLoss = function(spun, bet) + if spun[0] == spun[1] then + if spun[0] == spun[2] then + winTriple spun[0], bet + else + winDouble spun[0], bet + end if + else if spun[0] == spun[2] then + winDouble spun[0], bet + else if spun[1] == spun[2] then + winDouble spun[1], bet + else + lose bet + end if +end function + +ringBells = function(qty=5) + // I believe all the obnoxious beeping was to slow down the game + // and build suspense as each "wheel" appears. Our version: + wait 0.1 + for i in range(1, qty) + print char(7), "" + wait 0.05 + end for +end function + +// Main program +profit = 0 +while true + print + + // Get bet + while true + bet = input("Your bet? ").val + if 1 <= bet <= 100 then break + if bet < 1 then print "Minimum bet is $1" else print "House limits are $100" + end while + + // Spin 3 wheels (randomly picking a symbol for each one) + spun = [] + spun.push symbols[rnd * symbols.len] + spun.push symbols[rnd * symbols.len] + spun.push symbols[rnd * symbols.len] + print + ringBells 10; print spun[0], " " + ringBells 5; print spun[1], " " + ringBells 5; print spun[2] + print + + // Calculate and display win/loss + wait 0.5 + calcWinLoss spun, bet + + // Show new state, and maybe play again + print "Your standings are $ " + profit + yn = input("Again? ").lower + " " + if yn[0] != "y" then break +end while + +if profit == 0 then + print "Hey, you broke even." +else if profit > 0 then + print "Collect your winnings from the H&M cashier." +else + print "Pay up! Please leave your money on the terminal." +end if diff --git a/80_Slots/README.md b/80_Slots/README.md index dcc3aabe..522c7c81 100644 --- a/80_Slots/README.md +++ b/80_Slots/README.md @@ -17,6 +17,10 @@ As published in Basic Computer Games (1978): Downloaded from Vintage Basic at http://www.vintage-basic.net/games.html +#### Known Bugs + +- The original program does not correctly detect identical draws in the first and third position as a double (instead, it counts as a loss). This is probably not intended. Some of the ports fix this, so that any two matches count as a double. + #### Porting Notes (please note any difficulties or challenges in porting here)