mcostalba/Stockfish — pull request #2 by glinscott (2012-02-05 15:31:05+00:00)
Title: Detect stalemate in KXK endgames

Also, handle cases where there are 2 bishops of the same color.

Shouldn't be much effect on ELO, as bench remains the same:
Before:
Total time (ms) : 3911
Nodes searched : 5001819
Nodes/second : 1278910

After:
Total time (ms) : 3895
Nodes searched : 5001819
Nodes/second : 1284164

Handles the cases in http://www.talkchess.com/forum/viewtopic.php?t=42335.

position fen K7/Q7/8/8/8/8/5p2/7k w - - 0 1
go depth 1
K7/8/8/8/8/8/5Q2/7k b - - 0 1
info depth 1 seldepth 2 score cp 678 nodes 66 nps 3000 time 22 multipv 1 pv a7f7
bestmove a7f7 ponder (none)

position fen 8/1p4p1/2k2R1p/8/8/8/1r5r/K7 b - - 0 1
go infinite
...
info depth 33 seldepth 76 score cp 1074 upperbound nodes 6348446 nps 2106319 time 3014 multipv 1 pv c6d5 f6f5 d5e4 f5e5 e4f4 e5f5 f4g3 f5g5 g3f3 g5f5 f3g3

Sample of FENs detected as stalemate:
K7/8/8/8/8/4N1Q1/8/7k b - - 0 1
K7/8/8/8/3Q4/6N1/8/4k3 b - - 0 1
K7/8/8/8/5Q2/7k/8/4N3 b - - 0 1
K7/8/8/8/5N1k/8/6Q1/8 b - - 0 1
K5Q1/8/8/8/8/8/5N1k/8 b - - 0 1
K7/8/8/8/4N3/5Q2/8/4k3 b - - 0 1
K7/8/1q6/8/8/8/k7/8 w - - 0 1
K7/8/1q6/8/8/8/8/k7 w - - 0 1
K7/8/1q6/8/8/k7/8/8 w - - 0 1
K7/8/1qk5/8/8/8/8/8 w - - 0 1