setscreen ('graphics')
% Create variables for player names
var p1 : string
var p2 : string
% We need variables to keep score
var score1, score2 : int
% Variables to choose a box from one to nine
var key1, key2 : char
% Variable to check if 'q' has been pressed
var que : char
% Welcome screen
put "TIC TAC TOE"
put skip
put "Player 1, Enter your name: " ..
get p1
put skip
put "Player 2, Enter your name: " ..
get p2
delay (900)
cls
put skip
put skip
put skip
put skip
put skip
put " Press any key to continue"
% To check if a start key has been pressed
var reply : string (1)
getch (reply)
cls
% 1 is in top left corner and 9 is in bottom right corner
put "Box 1 is located in the top left corner and Box 9 is"
put "located in the bottom right corner."
put skip
put "The numbers progress from left to right."
delay (10000)
cls
% Draw Tic Tac Toe Board
Draw.ThickLine (maxx div 3, maxy, maxx div 3, 0, 3, 20)
Draw.ThickLine ((maxx div 3) * 2, maxy, (maxx div 3) * 2, 0, 3, 20)
Draw.ThickLine (0, maxy div 3, maxx, maxy div 3, 3, 20)
Draw.ThickLine (0, (maxy div 3) * 2, maxx, (maxy div 3) * 2, 3, 20)
% Ask Player 1 to choose a number from 1 - 9
put p1, " , pick a number from 1 to 9"
if (hasch) then
key1 := getchar
if (key1 = '1') then
Draw.ThickLine (0, maxy, (maxx div 3), (maxy div 3) * 2, 3, red)
Draw.ThickLine (0, (maxx div 3) * 2, (maxx div 3), 0, 3, red)
end if
end if |