From a0d77610224729fc14a4f1d1dcd147eddb4f477d Mon Sep 17 00:00:00 2001 From: JoeStrout Date: Fri, 18 Aug 2023 07:38:02 -0700 Subject: [PATCH] Added MiniScript version of 47_Hi-Lo. --- .../47_Hi-Lo/MiniScript/README.md | 19 +++++++++ .../47_Hi-Lo/MiniScript/hi-lo.ms | 41 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 00_Alternate_Languages/47_Hi-Lo/MiniScript/README.md create mode 100644 00_Alternate_Languages/47_Hi-Lo/MiniScript/hi-lo.ms diff --git a/00_Alternate_Languages/47_Hi-Lo/MiniScript/README.md b/00_Alternate_Languages/47_Hi-Lo/MiniScript/README.md new file mode 100644 index 00000000..21af327d --- /dev/null +++ b/00_Alternate_Languages/47_Hi-Lo/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 hi-lo.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 hi-lo.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 "hi-lo" + run diff --git a/00_Alternate_Languages/47_Hi-Lo/MiniScript/hi-lo.ms b/00_Alternate_Languages/47_Hi-Lo/MiniScript/hi-lo.ms new file mode 100644 index 00000000..bd0801ee --- /dev/null +++ b/00_Alternate_Languages/47_Hi-Lo/MiniScript/hi-lo.ms @@ -0,0 +1,41 @@ +print " "*34 + "Hi Lo" +print " "*15 + "Creative Computing Morristown, New Jersey" +print; print; print +print "This is the game of hi lo."; print +print "You will have 6 tries to guess the amount of money in the" +print "hi lo jackpot, which is between 1 and 100 dollars. If you" +print "guess the amount, you win all the money in the jackpot!" +print "Then you get another chance to win more money. However," +print "if you do not guess the amount, the game ends."; print +total = 0 +while true + guesses=0 + print + number=floor(100*rnd) + while true + guess = input("Your guess? ").val + guesses += 1 + if guess < number then + print "Your guess is too low." + else if guess > number then + print "Your guess is too high." + else + print "Got it!!!!!!!!!! You win " + number + " dollars." + total += number + print "Your total winnings are now " + total + " dollars." + break + end if + if guesses >= 6 then + print "You blew it...too bad...the number was " + number + total = 0 + break + end if + end while + + print + yn = input("Play again (yes or no)?").lower + if not yn or yn[0] != "y" then break +end while + +print +print "So long. Hope you enjoyed yourself!!!"