mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-12 15:50:20 -08:00
Added MiniScript version of 47_Hi-Lo.
This commit is contained in:
19
00_Alternate_Languages/47_Hi-Lo/MiniScript/README.md
Normal file
19
00_Alternate_Languages/47_Hi-Lo/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 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
|
||||
41
00_Alternate_Languages/47_Hi-Lo/MiniScript/hi-lo.ms
Normal file
41
00_Alternate_Languages/47_Hi-Lo/MiniScript/hi-lo.ms
Normal file
@@ -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!!!"
|
||||
Reference in New Issue
Block a user