x x o
- o x
- - -
считает что он выиграл (первая строка) не различает крестик и нолик

эти переменные глобальные :
const
n=3; {размер поля 3х3}
var
x:array[1..n,1..n] of char; {поле}
Gstop:boolean;
chAi,chHum:char;
goi,goj:integer;
процедура выбора символа :
procedure CaseCh; {Выбор символа игрока и AI}
var
choice:char;
flag:boolean;
begin
flag:=True;
repeat
clrscr;
writeln('Если вы хотите играть крестиком, нажмите 1');
writeln('Если вы хотите играть ноликом, нажмите 2');
readln(choice);
case choice of
'1': begin
chAi:='o';
chHum:='x';
end;
'2': begin
chAi:='x';
chHum:='o';
end
else flag:=false;
end;
until flag;
clrscr;
end;{CaseCh}
сама ф-я проверки :
function CanWin(ch:char):boolean; {можно ли завершить игру победой}
var
countCh,NullPos:integer;
Win:boolean;
i,j:integer;
begin
{Проверка горизонталей}
Win:=false;
i:=1;
countCh:=0;
NullPos:=0;
while (i<=n)and(not(Win)) do
Begin
j:=1;
while (j<=n) do
begin
if x[i,j]=ch then
inc(countCh)
else
if x[i,j]='-' then
begin
inc(NullPos);
goi:=i;
goj:=j;
end;
inc(j);
end;
if (countCh=2)and(NullPos>0) then
Win:=True;
if not(Win) then inc(i);
end;{горизонтали}
{Проверка вертикалей}
if not(Win) then
begin
countCh:=0;
NullPos:=0;
j:=1;
while (j<=n)and(not(Win)) do
begin
i:=1;
while (i<=n) do
begin
if x[i,j]=ch then
inc(countCh)
else
if x[i,j]='-' then
begin
inc(NullPos);
goi:=i;
goj:=j;
end;
inc(i);
end;
if (countCh=2)and(NullPos>0) then
Win:=True;
if not(Win) then
inc(j);
end;
end;{вертикали}
if not(Win) then
{Проверка главной диагонали}
begin
i:=1;
countCh:=0;
NullPos:=0;
while(i<=n) do
begin
if x[i,i]=ch then
inc(countCh)
else
if x[i,i]='-' then
begin
inc(NullPos);
goi:=i;
goj:=j;
end;
inc(i);
end;
if (countCh=2)and(NullPos>0) then
Win:=true;
end;{Диагональ}
if not(Win) then
{Проверка побочной диагонали}
begin
countCh:=0;
NullPos:=0;
i:=1;
while (i<=n) do
begin
if x[i,n-i+1]=ch then
inc(countCh)
else
if x[i,n-i+i]='-' then
begin
inc(NullPos);
goi:=i;
goj:=n-i+1;
end;
inc(i);
end;
if countCh=2 then
Win:=True;
end;{побочная}
CanWin:=Win;
end;{CanWin}
использование в основной программе :
if CanWin(ChAi) then
begin
x[goi,goj]:=chAi;
Gstop:=True;
end
else
if CanWin(ChHum) then
x[goi,goj]:=chAi
else
AiGo;
помогите с передачей параметров :p2: