Tuesday, November 16, 2010

Legal moves

I added a legal move generator this proved to be a much more difficult task than I initially thought.

First I thought that only adding X-ray lookups do the job. Two rules:

- don't put the king where it can be attacked
- don't move a piece from the line in which the king is x-ray attacked

But I had to add the following rules as well:

- if single checked by slider: take attacker or opposing king or move between
- if double checked: just take opposing king if possible

It took a lot of debugging before I got good perft results again:

Depth 5 took 14.2 seconds
Depth 6 took 6 minutes 10 seconds now, almost factor 5 improvement.

No comments:

Post a Comment