Author: Edward Seid
Date: 13:24:22 10/30/03
Go up one level in this thread
On October 30, 2003 at 10:32:16, Robert Hyatt wrote:
>any reasonable language interprets 0 as "false" and non-zero as
>"true".
I've confirmed that Visual Basic.NET is a 'reasonable language', using that
criteria :)
I located the source of my confusion...
Bruce Moreland used the following notation in his explanation of 0x88:
while (!(index & 0x88)) {
GenerateMove(index);
index += delta;
}
So I tried to translate that directly into VB.NET.
index = 75 --- test square is off the board, to the right
index AND &H88 --- result is &H08 = 8
Not (index And &H88) --- result is &HF7 (the 1's complement) = -9 = TRUE
The NOT operator applied to an Integer yields the 1's complement. To get the
expected result, I now explicitly convert to Boolean before applying the NOT
operator.
index = 75
index AND &H88 --- 8
Convert.ToBoolean(index AND &H88) --- TRUE
Not(Convert.ToBoolean(index AND &H88)) --- FALSE
A little confusing to this newbie programmer, but I'm learning.
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.