## Pascal

Moderators: None (Apply to moderate this forum)
Number of posts: 14004

This Forum Only

Tic-Tac-Toe Program Help Posted by brandanorama on 6 Feb 2013 at 4:21 PM
-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');

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.

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic