Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.