matchesTaken = 0
TextWindow.WriteLine("How many matches will be used?")
numOfMatches = TextWindow.ReadNumber()
firstMove = Math.GetRandomNumber(2)
FindFirstMove()
If PlayerFirst = "true" Then
TextWindow.WriteLine("You can go first")
Goto playerMoveLabel
Else
TextWindow.WriteLine("I'll go first")
Goto comMoveLabel
EndIf
If(numOfMatches <= 1) Then
Lose()
Else
Goto playerMoveLabel
EndIf
'Subroutines
Sub FindFirstMove
If firstMove = 1 Then
PlayerFirst = "true"
Else
PlayerFirst = "false"
EndIf
EndSub
Sub AI
smartAI = Math.GetRandomNumber(difficulty * difficulty)
If(smartAI < difficulty) Then
If(matchesTaken = 0) Then
comMatchesTaken = Math.GetRandomNumber(3)
Else
If(matchesTaken = 1) Then
comMatchesTaken = 3
ElseIf(matchesTaken = 2) Then
comMatchesTaken = 2
ElseIf(matchesTaken = 3)Then
comMatchesTaken= 1
EndIf
EndIf
Else
comMatchesTaken = Math.GetRandomNumber(3)
EndIf
Program.Delay(2000)
If(comMatchesTaken = 1) Then
TextWindow.WriteLine("I'll take " + comMatchesTaken + " match")
Else
TextWindow.WriteLine("I'll take " + comMatchesTaken + " matches")
EndIf
Program.Delay(1000)
EndSub
Sub Lose
TextWindow.WriteLine("You Lost!")
TextWindow.WriteLine("How's that floor taste?")
Program.Delay(3000)
Program.End()
EndSub
Sub Win
TextWindow.WriteLine("You won!")
TextWindow.WriteLine("You beat me, but next time you won't be so lucky...")
Program.Delay(3000)
Program.End()
EndSub