Yesterday all my troubles were not far away.
Yesterday I noticed that my chess program was playing much worse. It was a surprise for I thought I had made some improvements in move generation.
But today I found the bug. Before I started with move generation I made a small change. I tested if king had long castled then use the other pawn piece square table for it would help with king safety. Test was
this.WhiteHasCastled && WhiteKing.Location.ColNr <= 3 but I forgot that Colnr starts on ChessBoard.FIRSTCOLUMN and not 0.
I don't know why my chessboard is 12x12. It had something to do with knights at the border and the test if move is valid.
So my king safety was terrible yesterday for even I was able to win from Skipper quite quickly. Perhaps ELO went down to 1600.
Again 200 ELO bug or more
Moderator: Ras
-
hgm
- Posts: 28478
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Again 200 ELO bug or more
To prevent that sort of bug I usually redefine my board array, so that I can use negative indexes on it for the guard band, and the physical board neatly starts at 0:
Then board[0] is really the lower-left corner, and I can use straightforward.\, non-treacherous testing on the index.
Code: Select all
int rawBoard[(WIDTH+4)*(HEIGHT+4)]
#define board (rawBoard + 2*WIDTH + 2)