Quote:
To my knowledge this is exactly what Michel is doing, so it's certainly possible. I didn't carefully think about it because I assumed that:
1) bitboards would only easily allow base-4 indices instead of base 3. For 8 squares already this would waste 90% of the index space, not to mention larger patterns.
2) bitboards would "prefer" regularly-spaced, identically-shaped patterns. While this is what I have now, I preferred not to commit to such a design at an early stage.
Of course that was just intuition. I might be wrong on both counts.
I'm not sure I see the real problem.
Basically I was also thinking about a method in line what Michel proposed.
In the meantime I have tried to modify the Scan code slightly so the index function doesn't need the bd.trit, and I checked if the 2 approaches yield the same answer (and so far they seem to be alike)
So first i define some constants to make the program more readable. For a snapshot see below.
Code:
// Board Squares
#define SFLD1 6
#define SFLD2 7
#define SFLD3 8
#define SFLD4 9
#define SFLD5 10
#define SFLD6 11
#define SFLD7 12
#define SFLD8 13
#define SFLD9 14
#define SFLD10 15
#define SFLD11 17
...................................
#define SFLD50 59
Then I slightly changed the eval_float()
Code:
value1 += Weight[4 + 0 * 6561 + i9(bd, SFLD1, SFLD2, SFLD6, SFLD7, SFLD11, SFLD12, SFLD16, SFLD17)];
value1 += Weight[4 + 1 * 6561 + i9(bd, SFLD2, SFLD3, SFLD7, SFLD8, SFLD12, SFLD13, SFLD17, SFLD18)];
value1 += Weight[4 + 2 * 6561 + i9(bd, SFLD3, SFLD4, SFLD8, SFLD9, SFLD13, SFLD14, SFLD18, SFLD19)];
value1 += Weight[4 + 3 * 6561 + i9(bd, SFLD4, SFLD5, SFLD9, SFLD10, SFLD14, SFLD15, SFLD19, SFLD20)];
value1 += Weight[4 + 4 * 6561 + i9(bd, SFLD11, SFLD12, SFLD16, SFLD17, SFLD21, SFLD22, SFLD26, SFLD27)];
value1 += Weight[4 + 5 * 6561 + i9(bd, SFLD12, SFLD13, SFLD17, SFLD18, SFLD22, SFLD23, SFLD27, SFLD28)];
value1 += Weight[4 + 6 * 6561 + i9(bd, SFLD13, SFLD14, SFLD18, SFLD19, SFLD23, SFLD24, SFLD28, SFLD29)];
value1 += Weight[4 + 7 * 6561 + i9(bd, SFLD14, SFLD15, SFLD19, SFLD20, SFLD24, SFLD25, SFLD29, SFLD30)];
value1 += Weight[4 + 8 * 6561 + i9(bd, SFLD21, SFLD22, SFLD26, SFLD27, SFLD31, SFLD32, SFLD36, SFLD37)];
value1 += Weight[4 + 9 * 6561 + i9(bd, SFLD22, SFLD23, SFLD27, SFLD28, SFLD32, SFLD33, SFLD37, SFLD38)];
value1 += Weight[4 + 10 * 6561 + i9(bd, SFLD23, SFLD24, SFLD28, SFLD29, SFLD33, SFLD34, SFLD38, SFLD39)];
value1 += Weight[4 + 11 * 6561 + i9(bd, SFLD24, SFLD25, SFLD29, SFLD30, SFLD34, SFLD35, SFLD39, SFLD40)];
value1 += Weight[4 + 12 * 6561 + i9(bd, SFLD31, SFLD32, SFLD36, SFLD37, SFLD41, SFLD42, SFLD46, SFLD47)];
value1 += Weight[4 + 13 * 6561 + i9(bd, SFLD32, SFLD33, SFLD37, SFLD38, SFLD42, SFLD43, SFLD47, SFLD48)];
value1 += Weight[4 + 14 * 6561 + i9(bd, SFLD33, SFLD34, SFLD38, SFLD39, SFLD43, SFLD44, SFLD48, SFLD49)];
value1 += Weight[4 + 15 * 6561 + i9(bd, SFLD34, SFLD35, SFLD39, SFLD40, SFLD44, SFLD45, SFLD49, SFLD50)];
Introduced a new i9 index routine.
Code:
static int i9(const Board & bd, int s0, int s1, int s2, int s3, int s4, int s5, int s6, int s7) {
bit_t blackman = bd.bit(BM_INDEX), empty = Bit_Squares ^ ( bd.bit(WM_INDEX) | blackman);
return ((((((((
bdtrit(s0, blackman, empty)) * 3 +
bdtrit(s1, blackman, empty)) * 3 +
bdtrit(s2, blackman, empty)) * 3 +
bdtrit(s3, blackman, empty)) * 3 +
bdtrit(s4, blackman, empty)) * 3 +
bdtrit(s5, blackman, empty)) * 3 +
bdtrit(s6, blackman, empty)) * 3 +
bdtrit(s7, blackman, empty));
}
And a inline definition for bdtrit
Code:
inline int bdtrit(int square, bit_t blackman, bit_t empty) {
bit_t bitsquare = (bit_t)1 << square;
if (bitsquare & blackman) return (2);
else if (bitsquare & empty) return (1);
else return (0);
}
And so far it seems to work.
Bert