Feb 10, 2007

[Other] Going about it the wrong way

When starting to work on this version of Mediocre my goal was to keep the node count intact while improving the nodes per second. That is not changing the actual calculation at all, only speed it up.

I wanted to implement the new move representation and remove all slow Vector calls.

When I started looking through the code I found a whole bunch of badly coded details so I changed them as I went along.

I also had to change things like unmake move to make the new move generation possible.

The result was a version filled with bugs which actually was not running faster since the node count was much higher (for some reason) and made weird moves and crashed from time to time.

I managed to track down a few of the bugs, for example when running the UCI version the history array in the Board-object kept overflowing, this was due to UCI replaying the moves on the board, but it did not reset the history index.

But new bugs kept showing up.

So I decided to start from the beginning again and wait with the new move representation until everything was in place for it to work.

I have now fixed the issue with the isAttacked-method, written a better capture generation algorithm, implemented the new history array for the Board-class, changed the sort values for hash and killer moves, and moved the move generation in alpha-beta so it does not generate moves on leaf-nodes.

These simple changes has made a tremendous difference. And most importantly they work without bugs.

The next step is replacing the Vectors with arrays and make them work flawlessly, and finally, when everything else is in place, implement the new move representation.

While the move representation might not speed up the engine quite as much as I had thought (the other changes are more important) it -will- be very important for the size of the transposition table, so sooner or later I will have to do it.

Lesson to be learnt; keep your changes structured and do not do it like I did. :)

No comments: