Simplify eval take 2.  Bench 5097444
Slight tweak to king safety.  Bench: 5534531
Merge branch 'master' into simplify_eval
Add clop parameters
CLOP tuned
Merge branch 'simplify_eval' into bishop_pin_clop
Use CLOP mean value instead of max
Simplify bitbase.cpp

Use a std::vector to store positions and
rearrange KPKPosition.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Speedup KPK bitbase of 25%

Change the way the index is coded so that
now looping from 0 to IndexMax generates
the pawns from RANK_7 down to RANK2.

Becuase positions with pawns at RANK_7
are easily classified as wins/draws, this
small trick allows to reduce the number
of needed iterations from 30 down to 26!

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Revert "Use CLOP mean value instead of max"

This reverts commit d0c2faa5fd9ad05f865d2a69b59efab43b2be421.
Merge branch 'master' into bishop_pin_clop
Add new clop tuned value
Further speed up bitbase generation

Another trick, along the same lines of previous
patch. This time we first check positions with
white side to move that, becuase we start with
pawn on rank 7, are easily classified as wins,
then black ones.

Number of cycles reduced to 15 !

Becuase now it is faster we can remove a lot of
code to detect theoretical draws. We will calculate
them anyhow, although a bit slower, but the speed
up trick more than compensates it.

Verified that generated bitbases match original ones.

No functional change.
Merge Gary's king safety tweak

Still well within error bars, so probably not a big improvement,
but may be worthwhile. I will let the test keep running. The idea
for the tweak came from the TCEC game against Houdini. Stockfish saw
it as a draw, well past when it should have seen problems. King safety
was off, since it was QN and pawns only, but in fact the king was
quite vulnerable.

After 8000 games at 60/1 (Gary's test)

ELO: -0.43 +- 99%: 10.02 95%: 7.62
Wins: 1235 Losses: 1245 Draws: 5520 Total: 8000

PGN of game against houdini. Moves 55-59 it was seeing a draw, and
Houdini was seeing a good sized advantage for black. With the change,
Stockfish now recognizes that moving the king there is a bad idea.

[Event "nTCEC - Stage 1 - Season 1"]
[Site "http://www.tcec-chess.net"]
[Date "2013.02.07"]
[Round "4.2"]
[White "Stockfish 2.31"]
[Black "Houdini 3.0"]
[Result "0-1"]
[Variant "normal"]

1. Nf3 Nf6 2. c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90. Qe8+ Kf4 91. Qg6 Qd5 92. Qg1 Qe4+ 93. Ka5 Qe2 94. Qg8 Kf3 95. Qd5+ Qe4
96. Qd1+ Kg2 97. Qd2+ Kf1 98. Qh2 f4 99. Qh3+ Ke2 100. Qg4+ Kd2 101. Qg5 Kc2
102. Qh4 0-1

bench: 5518286
Account for gamePly after each move

Rename startPosPly to gamePly and increment/decrement
the variable after each do/undo move. This adds a little
overhead in do_move() but we will need to have the
game ply during the search for the next patches now
under test.

Currently we don't increment gamePly in do_null_move()
becuase it is not needed at the moment. Could change
in the future.

As a nice side effect we can now remove an hack in
startpos_ply_counter().

No functional change.
Back to CLOP average values
Update copyright year

No functional change.
Bring back original bonus
Merge branch 'master' into bishop_pin_clop
Print leading zeroes in hash keys

And convert to uppercase. Reset the stream to dec too.

[Edit: Also fixed the hash key in Position::pretty()]