Pascal

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

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
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');

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.



 

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
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.