Program Tic_tac; { noughts and crosses where you intelligently(?) play the } { computer which plays randomly, on a 4x4 board array } { The computer is NOUGHTS, User(you) are CROSSES } { .........designed by wOnKoTHESANE } Uses WinCrt; Const last = 4; Type rows = 1..last; cols = 1..last; Var row, inrow : rows; col, incol : cols; board : array[rows,cols] of char; Procedure Opening_Screen; begin clrscr; writeln; writeln; writeln; writeln(' T I C T A C T O E'); writeln; writeln(' conceived, written and performed (without a net) by:'); writeln(' insert your name here'); writeln; writeln; writeln; writeln; writeln('The computer will play (randomly) at NOUGHTS AND CROSSES'); writeln('your task is to BEAT, or at least DRAW with the computer'); writeln; writeln; write('....press a key to begin'); readln; end; Procedure Initialize; begin for row:= 1 to last do for col:= 1 to last do board[row,col]:= '-'; end; Procedure Draw_Board; begin clrscr; writeln; writeln; writeln; for row:= 1 to last do begin for col:= 1 to last do write(board[row,col]:5); writeln end; writeln; writeln; writeln; end; Procedure Computer_Moves; begin randomize; {your code to go here} end; Procedure Get_User_Move; begin writeln('You are CROSSES, the computer is NOUGHTS, your move...'); writeln; write('Please Type in the ROW of your intended move :'); readln(inrow); write('Please Type in the COLUMN of your intended move :'); readln(incol); {code missing here} end; Function Winner(It:char):Boolean; begin Winner:=false; {check all rows for a win} {check all columns for a win} {check diagonals for a win} end; Function Tied_Game:boolean; begin {your code to go here} end; Function End_Of_Game:boolean; begin End_Of_Game:= (Winner('X')) or (Winner('O')) or (Tied_Game) end; Begin Opening_Screen; Initialize; repeat Computer_Moves; {computer goes first each game} if not(End_Of_Game) then Get_User_Move; {no point otherwise} until End_Of_Game; if Winner('X') then writeln('Congratulations, you won') else if Winner('O') then writeln('You have been beaten by random moves !') else writeln('A Tied Game, What a Pain'); writeln; writeln; writeln('Tha albatross did not signify'); repeat until keypressed End .