Buenas, ando en busca de ayuda. Estoy haciendo un TATETI entre dos jugadores humanos, y me surgió un problema al momento de verificar quien gana. el código es este ..
Código Delphi
[-]
begin
aux:= aux+1;
if (aux mod 2 <> 0) then
begin
(sender as timage).picture:= form2.image1.Picture;
(sender as timage).enabled:= false;
if tag = 1 then
matriz[1,1]:= 1
else
if tag = 1 then
matriz[1,2]:=1
else
if tag =3 then
matriz[1,3]:=1
else
if tag = 4 then
matriz[2,1]:=1
else
if tag = 5 then
matriz[2,2]:=1
else
if tag = 6 then
matriz[2,3]:=1
else
if tag = 7 then
matriz[3,1]:= 1
else
if tag = 8 then
matriz[3,2]:=1
else
matriz[3,3]:=1;
for i:=8 to 248 do
begin
sleep(1);
refresh;
shape1.top:=i;
end;
end
else
begin
(sender as timage).picture:= form2.image2.Picture;
(sender as timage).enabled:= false;
if tag = 1 then
showmessage('Hola')
else
if tag = 2 then
matriz[1,2]:=2
else
if tag =3 then
matriz[1,3]:=2
else
if tag = 4 then
matriz[2,1]:=2
else
if tag = 5 then
matriz[2,2]:=2
else
if tag = 6 then
matriz[2,3]:=2
else
if tag = 7 then
matriz[3,1]:= 2
else
if tag = 8 then
matriz[3,2]:=2
else
matriz[3,3]:=2;
for i := 248 downto 8 do
begin
sleep(1);
refresh;
shape1.Top:=i;
end;
end;
end;
tengo 9 imágenes y cada ves que uno de los jugadores hace click en una de las imágenes en teoría carga un valor en la matriz, 1 si es el jugador 1 o 2 si es el jugador 2. Lo que había hecho es ponerle a cada una de las imágenes ponerle un tag de 1 a 9, pero me di cuenta de que el problema esta en que no cargo la matriz con ningún valor. Gracias de antemano.
Pd: el cartel de hola esta de mas pero era para ver si me cargaba la matriz .