Ver Mensaje Individual
  #6  
Antiguo 28-03-2013
Neg90 Neg90 is offline
Miembro
NULL
 
Registrado: mar 2013
Posts: 29
Reputación: 0
Neg90 Va por buen camino
A mira esta buena esa, ahora que la veo capas que me sirve mas que la que implemente yo, por que me quedo medio feo (o del todo :P) el tema de ver quien gana o si empatan

Código Delphi [-]
if (((matriz[1,1] <>0) and (matriz[1,2] <>0)) and ((matriz[1,3] <> 0)) and
      ((matriz[2,1] <>0) and (matriz[2,2] <>0)) and ((matriz[2,3] <> 0)) and
      ((matriz[3,1] <>0) and (matriz[3,2] <>0)) and ((matriz[3,3] <> 0))
      and (no2 =true ) and (no1 = true)) then
            showmessage('Emptaron');
   no1:=true;
   no2:=true;
   aux:= aux+1;
   if (aux mod 2 <> 0) then
     begin
       (sender as timage).picture:= form2.image1.picture;
       (sender as timage).enabled:= false;
       case (sender as timage).Tag of
         1:matriz[1,1]:=1;
         2:matriz[1,2]:=1;
         3:matriz[1,3]:=1;
         4:matriz[2,1]:=1;
         5:matriz[2,2]:=1;
         6:matriz[2,3]:=1;
         7:matriz[3,1]:=1;
         8:matriz[3,2]:=1;
         9:matriz[3,3]:=1;
       end;
       for i:=8 to  248 do
         begin
           sleep(1);
           refresh;
           shape1.top:=i;
         end;
         if ((matriz[1,1] =1) and (matriz[1,2] =1)) and ((matriz[1,3] = 1)) or
            ((matriz[2,1] =1) and (matriz[2,2] =1)) and ((matriz[2,3] = 1)) or
            ((matriz[3,1] =1) and (matriz[3,2] =1)) and ((matriz[3,3] = 1)) or
            ((matriz[1,1] =1) and (matriz[2,1] =1)) and ((matriz[3,1] = 1)) or
            ((matriz[1,2] =1) and (matriz[2,2] =1)) and ((matriz[3,2] = 1)) or
            ((matriz[1,3] =1) and (matriz[2,3] =1)) and ((matriz[3,3] = 1)) or
            ((matriz[1,1] =1) and (matriz[2,2] =1)) and ((matriz[3,3] = 1)) or
            ((matriz[3,1] =1) and (matriz[2,2] =1)) and ((matriz[1,3] = 1)) then
              begin
               showmessage('Gana '+ label1.Caption);
               no1:=true;
              end;
     end
   else
     begin
       (sender as timage).picture:= form2.image2.Picture;
       (sender as timage).enabled:= false;
       case (sender as timage).Tag of
         1:matriz[1,1]:=2;
         2:matriz[1,2]:=2;
         3:matriz[1,3]:=2;
         4:matriz[2,1]:=2;
         5:matriz[2,2]:=2;
         6:matriz[2,3]:=2;
         7:matriz[3,1]:=2;
         8:matriz[3,2]:=2;
         9:matriz[3,3]:=2;
       end;
       for i := 248 downto 8 do
         begin
           sleep(1);
           refresh;
           shape1.Top:=i;
         end;
       if ((matriz[1,1] =2) and (matriz[1,2] =2)) and ((matriz[1,3] = 2)) or
         ((matriz[2,1] =2) and (matriz[2,2] =2)) and ((matriz[2,3] = 2)) or
         ((matriz[3,1] =2) and (matriz[3,2] =2)) and ((matriz[3,3] = 2)) or
         ((matriz[1,1] =2) and (matriz[2,1] =2)) and ((matriz[3,1] = 2)) or
         ((matriz[1,2] =2) and (matriz[2,2] =2)) and ((matriz[3,2] = 2)) or
         ((matriz[1,3] =2) and (matriz[2,3] =2)) and ((matriz[3,3] = 2)) or
         ((matriz[1,1] =2) and (matriz[2,2] =2)) and ((matriz[3,3] = 2)) or
         ((matriz[3,1] =2) and (matriz[2,2] =2)) and ((matriz[1,3] = 2)) then
           begin
             showmessage('Gana ' + label2.Caption);
             no2:=true;
           end;
     end;

Voy a ver que hago si encuentro una forma mas practica de encontrar ganador/empate en mi algoritmo o implemento el que vos decís y pruebo. escucho cualquier sugerencia estoy complicado con el tema, hace poco arranque a estudiar delphi así que todo me sirve. Les agradezco por ayudarme desde ya.
Responder Con Cita