Thu 17 May 2012 09:04:44 PM UTC, comment #1:
Howdy Guido,
I reviewed your last set of changes and I think I see where the
confusion is occurring, and what is driving the odd results.
A TanBoard structure which is defined as:
typedef unsigned int TanBoard[2][25];
Represent both players on the board. However the evaluation functions in
GNUBG assume the player on roll/move is ALWAYS player 1 (not player 0).
So whatever you do you have to make sure that you swap the board and the
score if the board passed in has player 0 on roll/move.
That is why this old code was very important:
anScore[ 0 ] = fTurn ? nScoreOpponent : nScore;
anScore[ 1 ] = fTurn ? nScore : nScoreOpponent;
...
if ( !fTurn )
SwapSides( anBoard );
I noticed you no longer swap the scores and the swapsides function is no
longer called and the score code no longer swaps:
anScore[ 0 ] = nScoreOpponent;
anScore[ 1 ] = nScore;
If you adjust your thinking and put back in the swapping so that the
perspective of player on roll/move is ALWAYS player 1 (never player 0),
and adjust the rest of your code to follow suit you should be able to
get it working.
I believe that the reason you are always seeing a take in these
situations is because the position was evaluated from the wrong player
being on roll/move. Namely in your example you sent, the bearoff
position had the person way behind cubing and of course the opponent had
a take. There are probably cases where the code would work and that is
where the FIBSBOARD had the person cubing already as player 1 (and the
swapping is unnecessary).
I hope that helps, I am pretty sure you will come up with a solution
based on this tidbit.
|