Tic-Tac-Toe Program Help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Tic-Tac-Toe Program Help

brandanoramabrandanorama Posts: 2Member
-Brandan Bala******
I am completely lost in arrays i have no idea how to use them, let alone use them in my program. I would really appreciate some help in the program below (what i have so far) and some help on how to use arrays. This is "Free Pascals" by the way.










Program TicTacToe;
Uses crt;
Var x:integer;
y:integer;
r:integer;
i:integer;
Tic:ARRAY[1..3, 1..3] Of INTEGER;

Row: 1..3;
Column: 1..3;

procedure board;
var bla:integer;

BEGIN

writeln(' | | ');
writeln(' | | ');
writeln(' | | ');
writeln('___________');
writeln(' | | ');
writeln(' | | ');
writeln(' | | ');
writeln('___________');
writeln(' | | ');
writeln(' | | ');
writeln(' | | ');

end;

procedure piece;
var bla,x,y,xoro:integer;
r,m, c:CHAR;

begin
cursoroff;
xoro:=1;
x:=2;
y:=2;


repeat
If (c=' ') then
y:=y+0
else
begin;
clrscr;
end;

board;

gotoxy(x,y);
If (xoro mod 2=0)
then
write('x')
else
write('o');

c:= readkey;

case c of
#72: begin
y:=y-4;
If (x<=10) and (y<=10) then
y:=y+0
else y:=y+4
end;

#75: begin
x:=x-4;
If (x<=10) and (y<=10) then
y:=y+0
else y:=x+4
end;

#80: begin
y:=y+4;
If (x<=10) and (y<=10) then
y:=y+0
else y:=y-4
end;

#77: begin
x:=x+4;
If (x<=10) and (y<=10) then
y:=y+0
else x:=x-4
end;

#78: begin
x div 4:=actualx;
y div 4:=actualy;
xoro:=xoro+1
end;
end;
until(c='q');

end;

{
procedure piece;
var bla,x,y:integer;
r,m, c:CHAR;

}
begin


PIECE;


end.
Sign In or Register to comment.