Author: José Carlos
Date: 06:02:00 12/27/01
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++);
{
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++;
}
which fills two lists with information for pawn eval. When I run it, then it
performed an unhandled exception. I traced it and, to my surprise, when
initializing i in the second loop (exactly after executing the second for), the
value of i was 8!!!
I changed i for other variable; same thing. I tried to loop from
PosActual->NumPeonesN-1 down to zero; then i got a very big value instead of 7
-there were 8 pawns- (i is an integer).
Finally, I had to do a 'while' instead of a 'for' and it worked perfectly.
Can anyone tell me if I'm doing something wrong in the above code?
Thanks in advance.
José C.
This page took 0.01 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.