Microsoft Small Basic

Program Listing: VTC563
'Published ID#
' Tell TicTacToe to call PlayInFirstEmptySpot (recipe below) when it's X's turn --#4
TicTacToe.TurnForPlayerX = PlayInFirstEmptySpot
'Start TicTacToe --#3
TicTacToe.Start()

'------------- Recipe for PlayInFirstEmptySpot --#2
Sub PlayInFirstEmptySpot
' Do the following 9 times --#6
For i = 1 To 9
' if the tictactoe board is empty for current square you trying --#5 (fake w/1)
If (TicTacToe.IsEmpty(i)) Then
' Play your piece on that square on the TicTacToe board --#1(fake w/1)
TicTacToe.PlayPiece(i)
' and set the current value of i to 10 --#7
i = 10
EndIf
' Repeat
EndFor
'------------- End of PlayInFirstEmptySpot recipe --#2
EndSub