I'd missed this condition, took me a bit of head-scratching why it would no longer recognise BB as a pair with mate potential after fixing some other issues.hgm wrote: UNLESS the other piece happens to be able to attack both b1 and c2 at the same time.
It now correctly identifies BB, BN, B(FA) and N(FA) as mating pairs and FF as defective. It also finds FN as a winning pair, which is not really optimal but better than stumbling into one of the KFNK losing positions. Now that it considers KFNK as a winning pair, Sjaak will no longer return a draw score from the evaluation.
Sjaak currently doesn't list NW as a winning pair. I'm not sure why, but it could be that the retrograde analysis it does is simply too crude. What it tries to do is proof that there is at least one mate position that cannot be avoided by choice, which it does by unmaking the last two moves and seeing whether it can put the defending king in a position where it has no choice but to walk into the mate. If it can, it marks the pair as "winning". Of course, two moves are not necessarily enough to proof that no win is possible. Perhaps I should change this so it just builds up a proper bitbase, but in order to assess whether the result indicates that mate can be forced or not is a bit more tricky. Or I can keep the bitbase around and use it in the search…The latter clause makes that KNWK is a general win: both N and W are color alternators, and could thus never do case 1 (the corner mate). N is forking, but does need to be at b3 for that. But you can afford to relocate the attacking King to a3, because W at c1 would attack c2, so that the King doesn't have to cover it. In addition the Knight can switch in one move from covering c2 to delivering the fork (if it is on d4).
I could also change the scoring for pairs. What Sjaak knows is whether a pair can force mate. What it assumes is that it can invert this to say that pairs where it doesn't know they can mate, can't. It currently forces the score to 0 in that case, but I could just divide by a large factor instead...
It doesn't identify FZ as a mating pair either (but it does get BZ).Note that this still doesn't cover everything; e.g. the case Zebra + Ferz. The zebra does +/-2 on one coordinate, and +/-3 to the other, and there is no way to make 0 of those with 3 terms, so it cannot make the (0,1) step from c1 to b1. So it doesn't seem a useful support to the Ferz' fork. Because the Zebra is color-alternating it it also cannot do the c1-a1 3-step tour. Yet they have mating potential, because you can afford to put the attacking King on c3, using Fb2 to trap the bare King on a2-b1, which both can be covered by a Zebra on d4. This pattern requires a 'double-forking' piece like Ferz, which can cover c1, a1 and a3 at the same time, (but also the WN can do that), plus a piece that can attack b1 and a2 at once. Knight could do the latter from c3, but is again disqualified because its King needs to be there.
I do, but I'm not sure it's doing a particularly good job of it at the moment anyway. But I probably will change over to using an actual bitbase eventually, and that should make everything nice and consistent. For now, I try placing the king on A8 and B8, which works better than just placing it on A8, but it may be even better to just scan the entire board. It's mostly pointless in the sense that if you can't mate the king in the upper left quadrant, you're unlikely to do it in one of the other ones, but if you have asymmetric pieces it could happen...I know that you want Sjaak also to work for non-orthodox Kings, but it is really important to not only consider corner mates, as you will miss many won end-games that way. I think in Team-Mate Chess some of the teams even need to mate the King on c1 (using a forking piece to cover b1 and d1).
Right now, Sjaak's evaluation identifies KNNK and KNNKN as dead draws, which isn't ideal. The other ones are simply evaluated as equal, since either side has mate potential.Anyway, general draws should be treated like KQKQ or KNNKN, which are still a tad worse than KRKR and KNNK. In the latter you can assume a hard draw limiting the search to a few ply, (3 or 1). But in KQKQ or KNNKN there are some longer wins, so you really should not limit the search depth, but just evaluate them as marginally better than a dead draw.
The search isn't affected directly.
