Simplify Option c'tor

No functional change.
Revert "Simplify Option c'tor"

std::to_string() is C++11 material, not c++03.

So revert the patch.
Enable link time optimization only when optimizing

Because it is quite slow, skip it when 'optimize' flag is 'no'

No functional change.
Rename *last to *end

It is a more correct name because it points past the
last move of the list.

No functional change.
Simplify generate_castle()

Skipping the calls to std::min(), std::man() we get
even a nice speed-up on perft.

No functional change.
Remove redundancy in move generation

Introduce generate_all_moves() and remove a good
bunch of redundant code.

No functional change.
Speed-up generate<LEGAL>

The trick here is to check for legality only in the
(rare) cases we have pinned pieces or a king move
or an en-passant.

This trick is able to increase the speed of perft
of more then 20%!

No functional change.
Fix MSVC 2012 64bits warnings

Reported by Rein.

No functional change.
Don't exit earlier from aspiration window loop

Currently we exit the loop when

abs(bestValue) >= VALUE_KNOWN_WIN

but there is no logical reason for this. It seems more
natural to re-search again with full open window.

This has practically no impact in most cases, we have a
'no functional change' running 'bench' command.
Fix compile with Intel 13.0

It seems Intel is unable to properly workout templates with 'static'
storage specifier.

Workaround using an anonymous namespace instead.

No functional change.
Stockfish 2.3

Stockfish bench signature is: 5416292
Restore development version

No functional change.
Fix KpsK endgame

Broken by commit a44c5cf4f77b05a03 of 3 /12 / 2011 that
was labeled "No functional change" because our 'bench'
test didn't triggered that particular endgame. Indeed
we need to run a specific bench on a set of endgames
position when touching endgame.cpp because normal bench
does not cover endgames properly.

Found by MSVC 2012 code analyzer.
Rename class Book to PolyglotBook

And move struct BookEntry out of the header where it is
not needed.

No functional change.
Fix crash under Chess 960

We have a crash with this position:

rkqbnnbr/pppppppp/8/8/8/8/PPPPPPPP/RKQBNNBR w HAha -

What happens is that even if we are castling QUEEN_SIDE,
in this case we have kfrom (B8) < kto (C8) so the loop
that checks for attackers runs forever leading to a crash.

The fix is to check for (kto > kfrom) instead of
Side == KING_SIDE, but this is slower in the normal case of
ortodhox chess, so rewrite generate_castle() to handle the
chess960 case as a template parameter and allow the compiler
to optimize out the comparison in case of normal chess.

Reported by Ray Banks.
Simplify BSFTable initialization

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Fix compile on 64 bits

Reported by Quocvuong82.

No functional change.
Bonus for rook/queen attacking pawns on same rank

Patch and tuning by Gary Linscott from an idea of Ryan Taker.

Double tested by Gary:

Wins: 3390 Losses: 2972 Draws: 11323
LOS: 99.999992%
ELO: 8.213465 +- 99%: 6.746506 95%: 5.124415
Win%: 51.181792 +- 99%: 0.969791 95%: 0.736740

And by me:

After 5612 games 1255  1085  3271 +11 ELO
Stockfish 2.3.1

Stockfish bench signature is: 5423738
Restore development version