Author: Scott Gasch
Date: 00:25:07 01/20/03
Go up one level in this thread
On January 20, 2003 at 01:10:23, Russell Reagan wrote:
>Anyway, about your idea to use 10 bits, I don't think we're talking about 1MB,
>because Ed's 8-bit approach is close to 1MB already. Ed's is a 12 x 256 x 256
>array, which comes out to 786,432 elements at one byte each. I calculate 12 x
>1024 x 1024 which comes out to 12,582,912 bytes using 10-bit keys. So you're
>talking about 12 MB of space, which is ok except for the cache unfriendliness of >it. At least with Ed's approach you can store a good chunk of it in the cache if>needed.
Ok maybe I'm thinking about thiw wrong but if you have 10 bits for both white
and black you have 1024 possibilities each side (2^10). Now assume a lookup
table that is 1024x1024 entries (white square attacks on the horizonal, black on
the vertical). That is 1M (1048576) entries, say, at one byte a piece. You can
also do a simple comparison of the two attack bitvectors before you hit the
memory because if one is zero and the other is non-zero the non-zero side
controls the square by default without the need to hit RAM.
I've also been trying to come up with a quick way to do this without a table
lookup and have not arrived at anything wonderful yet. One partial idea is
using some sort of small struct instead of bitboards:
typedef struct
{
char uPawnAttacks;
char uMinorAttacks;
char uRookAttacks;
char uQueenAttacks;
char uKingAttacks;
}
ATTACK_NODE;
ATTACK_NODE g_AttackTable[64][2];
Now instead of a bitvector you have counts (which is more memory hungry). But
you get these benefits:
1. It works no matter how many pieces / types are attacking a square. Even if
you promote and have three queens attacking the same square it works. In Ed's
way and even my 10-bit way you run out of bits after promotions.
2. You ditch the lookup table in favor of just computing the score. You can
compute the score pretty quickly by translating the struct above into an N bit
unsigned number where pawns are the most significant bit. When you have both
numbers, compare them. Whichever is higher controls the square.
I'm in serious brainstorming mode and appreciate the dialogue / ideas / advice.
Scott
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.