Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #6  
Antiguo 15-11-2006
dany2006 dany2006 is offline
Miembro
 
Registrado: nov 2006
Posts: 18
Poder: 0
dany2006 Va por buen camino
Respuesta

CLARO Q SI. CUANDO TERMINE EL JUEGUITO LO MANDO COMPLETO PARA Q SE ENTIENDA MEJOR.
Código Delphi [-]
void TForm1::calculo_grupo(){
    if (vecinos_examinados==0) {
        grupo->Cols[0]->Clear();
        grupo->Cols[1]->Clear();
        grupo->Cells[0][0]=IntToStr(X);
        grupo->Cells[1][0]=IntToStr(Y);
    }
    if (X+1<=10)
    if (matriz_color->Cells[X][Y]==matriz_color->Cells[X+1][Y]) {
        bool repetido=false;
        for (int i=0; i <= 20; i++) {
            if ( (grupo->Cells[0][i]==IntToStr(X+1)) &&
                 (grupo->Cells[1][i]==IntToStr(Y)) ){
                        repetido=true;
            }
        }
        if (repetido==false) {
            cant_vecinos++;
            grupo->Cells[0][cant_vecinos]=IntToStr(X+1);
            grupo->Cells[1][cant_vecinos]=IntToStr(Y);
        }
    }
    if (X-1>=0)
    if (matriz_color->Cells[X][Y]==matriz_color->Cells[X-1][Y]) {
        bool repetido=false;
        for (int i=0; i <= 20; i++) {
            if ( (grupo->Cells[0][i]==IntToStr(X-1)) &&
                 (grupo->Cells[1][i]==IntToStr(Y)) ){
                        repetido=true;
            }
        }
        if (repetido==false) {
            cant_vecinos++;
            grupo->Cells[0][cant_vecinos]=IntToStr(X-1);
            grupo->Cells[1][cant_vecinos]=IntToStr(Y);
        }
    }
    if (Y+1<=10)
    if (matriz_color->Cells[X][Y]==matriz_color->Cells[X][Y+1]) {
        bool repetido=false;
        for (int i=0; i <= 20; i++) {
            if ( (grupo->Cells[0][i]==IntToStr(X)) &&
                 (grupo->Cells[1][i]==IntToStr(Y+1)) ){
                        repetido=true;
            }
        }
        if (repetido==false) {
            cant_vecinos++;
            grupo->Cells[0][cant_vecinos]=IntToStr(X);
            grupo->Cells[1][cant_vecinos]=IntToStr(Y+1);
        }
    }
    if (Y-1>=0)
    if (matriz_color->Cells[X][Y]==matriz_color->Cells[X][Y-1]) {
        bool repetido=false;
        for (int i=0; i <= 20; i++) {
            if ( (grupo->Cells[0][i]==IntToStr(X)) &&
                 (grupo->Cells[1][i]==IntToStr(Y-1)) ){
                        repetido=true;
            }
        }
        if (repetido==false) {
            cant_vecinos++;
            grupo->Cells[0][cant_vecinos]=IntToStr(X);
            grupo->Cells[1][cant_vecinos]=IntToStr(Y-1);
        }
    }
    if (cant_vecinos>0 && cant_vecinos>vecinos_examinados) {
        vecinos_examinados++;
        X=StrToInt(grupo->Cells[0][vecinos_examinados]);
        Y=StrToInt(grupo->Cells[1][vecinos_examinados]);
        calculo_grupo();
    }
}

Última edición por vtdeleon fecha: 18-11-2006 a las 22:50:44.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Inserción de datos consecutivos pallyJD Tablas planas 1 27-10-2006 18:22:34
Los numeros del Pasaporte / DNI seoane Varios 5 31-05-2006 15:06:18
Formato numeros jzginez PHP 2 26-12-2005 16:18:56
Convertir Numeros dison Conexión con bases de datos 1 10-11-2004 18:07:45
¿¿Redondear números?? Magneto Varios 1 04-12-2003 04:58:00


La franja horaria es GMT +2. Ahora son las 19:01:26.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi