Refactor do_castle()

Not a real functional change, but bench changed due to different piecelist
reordering. To verify it a temporary my canonicalize_rooks function was
written as follows. It just ensures that the rook on the "smaller" square
is listed first.

void Position::canonicalize_rooks(Color c)
{
   if (pieceCount[c][ROOK] == 2)
   {
      Square s0 = pieceList[c][ROOK][0];
      Square s1 = pieceList[c][ROOK][1];
      if (s0 > s1)
      {
         pieceList[c][ROOK][0] = s1;
         pieceList[c][ROOK][1] = s0;
         index[s0] = 1;
         index[s1] = 0;
      }
   }
}

With this both bench and the test on Chess960 positions

./stockfish bench 128 1 8 Chess960.epd file > /dev/null

Gives same result.

bench: 4424151
Update polyglot.ini with new "Min Split Depth" default

No functional change.
Streamline time computation

No functional change.
Rewrite flip() to use FEN string manipulation

Instead of dealing directly with internal parameters
just "flip" the FEN string and set the position from
that.

No functional change.
Further tweak Position::flip

No functional change.
Increase LMR when not improving

Apply to LMR the same Eelco's idea
applied to move count pruning.

This is the result of a series of
attempts started by Thomas Kolarik.

Passed both short TC
LLR: 2.95 (-2.94, 2.94)
Total: 5675 W: 1241 L: 1117 D: 3317


And long TC:
LLR: 2.95 (-2.94, 2.94)
Total: 8748 W: 1689 L: 1539 D: 5520

bench: 4356801
Fix 'improving' condition

Because VALUE_NONE is 30002, it happens that
after a check the next move is never an improving
one.

After this patch bench signature is independent from
VALUE_NONE actual value.

bench: 4303194
Fix GrainSize rounding error

The rounding formula is different between
positive and negative scores due to the
GrainSize/2 term that is asymmetric.

So use truncation instead of rounding. This
guarantees that evaluation is rounded to zero
in the same way for both positive and negative
scores.

Found with position's flip

bench: 4634244
Don't set Search::RootColor in Eval::trace

Search::RootColor is a global parameter set
before to start a search, it is not something
trace() should change.

This patch allows to add trace() calls, for
debugging, inside search itself without altering
the bench, and also ensures that the values
returned by trace() and evaluate() are fully
equivalent.

No functional change.