Author: Michel Langeveld
Date: 06:11:23 12/27/01
Go up one level in this thread
On December 27, 2001 at 09:02:00, José Carlos wrote:
>
> When things like these happen, I don't know whether it is the compiler that
>doesn't work or I'm losing my mind. Yesterday I added this piece of code:
>
>for (i=0;i<PosActual->NumPeonesB;i++)
>{
> cCol=Columna(g_iPL_PB[i]);
> cFil=Fila(g_iPL_PB[i]);
> if (cFil>Retrasado(uPeonesB[cCol]))
>uPeonesB[cCol]=(ParteAvanzada(uPeonesB[cCol]))|(unsigned int)(cFil);
> if (cFil<Avanzado(uPeonesB[cCol]))
>uPeonesB[cCol]=(cFil<<16)|ParteRetrasada(uPeonesB[cCol]);
>}
>for (i=0;i<PosActual->NumPeonesN;i++);
You have an ; after the for. This probably not what you want.
>{
> cCol=Columna(g_iPL_PN[i]);
> cFil=Fila(g_iPL_PN[i]);
> if (cFil<Retrasado(uPeonesN[cCol]))
>uPeonesN[cCol]=(ParteAvanzada(uPeonesN[cCol]))|(unsigned int)(cFil);
> if (cFil>Avanzado(uPeonesN[cCol]))
>uPeonesN[cCol]=(cFil<<16)|ParteRetrasada(uPeonesN[cCol]);
> i++;
>}
And about the counter
for (int i=0; i<7; i++)
{
cout << i << endl;
}
cout << i << endl;
means that the counter printed is 7 at last.
In my opinion it's better not to rely i = 7 and make your code robust.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.