diff --git a/00_Alternate_Languages/73_Reverse/MiniScript/reverse.ms b/00_Alternate_Languages/73_Reverse/MiniScript/reverse.ms index a83d6b10..9d7396cf 100644 --- a/00_Alternate_Languages/73_Reverse/MiniScript/reverse.ms +++ b/00_Alternate_Languages/73_Reverse/MiniScript/reverse.ms @@ -32,21 +32,21 @@ printState = function print;print digits.join(" "); print end function -print " " * 32 + "REVERSE" -print " " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" +print " " * 32 + "Reverse" +print " " * 15 + "Creative Computing Morristown, New Jersey" print; print; print print "Reverse -- a game of skill" print -ans = input("Do you want the rules? ") +ans = input("Do you want the rules? ") + " " if ans != null and ans[0].lower == "y" then showRules -while 1 +while true turns = 0 digits = range(1, num) digits.shuffle print;print "Here we go ... the list is:" - while 1 + while true printState amt = input("How many shall I reverse? ").val if amt == null or amt == 0 then break @@ -64,8 +64,8 @@ while 1 end if end while print - ans = input("Try again (YES or NO)? ") + ans = input("Try again (YES or NO)? ") + " " print - if ans == null or ans[0].lower == "n" then break + if ans == null or ans[0].lower != "y" then break end while -print "O.K. Hope you had fun!!" \ No newline at end of file +print "O.K. Hope you had fun!!" diff --git a/00_Alternate_Languages/82_Stars/MiniScript/stars.ms b/00_Alternate_Languages/82_Stars/MiniScript/stars.ms index b4234622..d83d75b7 100644 --- a/00_Alternate_Languages/82_Stars/MiniScript/stars.ms +++ b/00_Alternate_Languages/82_Stars/MiniScript/stars.ms @@ -11,16 +11,16 @@ instructions = function print end function -print " " * 34 + "STARS" -print " " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" +print " " * 34 + "Stars" +print " " * 15 + "Creative Computing Morristown, New Jersey" print; print; print -ans = input("Do you want instructions? ").lower +ans = input("Do you want instructions? ").lower + " " if ans[0] == "y" then instructions end if -while 1 +while true print print "OK, I am thinking of a number, start guessing." starNum = floor(rnd * kMaxNum) + 1 diff --git a/00_Alternate_Languages/89_Tic-Tac-Toe/MiniScript/README.md b/00_Alternate_Languages/89_Tic-Tac-Toe/MiniScript/README.md new file mode 100644 index 00000000..6774c0d9 --- /dev/null +++ b/00_Alternate_Languages/89_Tic-Tac-Toe/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 tictactoe.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 "tictactoe" + run \ No newline at end of file diff --git a/00_Alternate_Languages/89_Tic-Tac-Toe/MiniScript/tictactoe.ms b/00_Alternate_Languages/89_Tic-Tac-Toe/MiniScript/tictactoe.ms new file mode 100644 index 00000000..8d472a7b --- /dev/null +++ b/00_Alternate_Languages/89_Tic-Tac-Toe/MiniScript/tictactoe.ms @@ -0,0 +1,90 @@ +// This program plays Tic Tac Toe +// The machine goes first and the way this is set up +// there's no way the human player can win. At best +// it will be a draw. +computerNext = function(x) + return x - 8 * floor((x - 1) / 8) +end function + +print " " * 30 + "TIC TAC TOE" +print " " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" +print; print; print + +print "The game board is numbered:" +print +print "1 2 3" +print "8 9 4" +print "7 6 5" +print + +while true + computer = 9 + gameOver = false + // MOVE ONE line 240 in original + // Computer always moves first and takes the center + print "Computer moves " + computer + player = input("Your move? ").val + playerFirstMove = player + + // MOVE TWO line 280 + // Computer's 2nd move - always the next space clockwise + // from the player's + computer = computerNext(player + 1) + canWinAt = computerNext(computer+4) + print "Computer moves " + computer + player = input("Your move? ").val + + // MOVE THREE line 300 + // Computer has two consecutive cells. This includes the + // middle so, to complete this 3-in-a-row, get the opposite + // value of comp's last move - which is four cells clockwise away. + + if player != canWinAt then + computer = canWinAt + print "Computer moves " + computer + print "... and wins ********" + gameOver = true + else + // Blocked - so two cells away from comp's last move + // line 360 + computer = computerNext(computer + 2) + print "Computer moves " + computer + end if + + if gameOver == false then + canWinAt = computerNext(computer+4) + player = input("Your move? ").val + + // MOVE FOUR - line 400 + if player != canWinAt then + computer = canWinAt + print "Computer moves " + computer + print "... and wins ********" + gameOver = true + else + // Foiled again! - line 450 + if playerFirstMove % 2 == 0 then + computer = computerNext(computer + 7) + print "Computer moves " + computer + print "... and wins ********" + gameOver = true + else // line 500 + computer = computerNext(computer + 3) + print "Computer moves " + computer + end if + end if + end if + + if gameOver == false then + // line 520 + player = input("Your move? ").val + if player != computerNext(computer + 4) then + computer = computerNext(computer + 4) + else + computer = computerNext(computer + 6) + end if + print "Computer moves " + computer + print "The game is a draw." + end if + print +end while