Scale contempt factor to zero at endgame

Contempt Factor is more effective at opening/middle game
and seems harmful at endgame phase. See:

http://chessprogramming.wikispaces.com/Contempt+Factor

http://web.archive.org/web/20070707023203/www.brucemo.com/compchess/programming/contempt.htm

Therefore we scale down the contempt factor while going
on with the game so to reach zero at endgame phase.

No functional change.
Retire can_return_tt() and rewirte TT-hit code

Simplify the code and doing this introduce a couple
of (very small) functional changes:

- Always compare to depth even in "mate value" condition
- TT cut-off in qsearch also in case of PvNode, as in search

Verified against regression with 2500 games at 30"+0.05
on 2 threads: 451 - 444 - 1602

Functional changed: new bench is 5544977
Use new 64 bit De Bruijn BitScan

Allows to sync 32 and 64 bits implementations.

Idea by Kim Walisch, reported by Gerd Isenberg:
http://talkchess.com/forum/viewtopic.php?t=45554

No functional change.
Retire BitCount8Bit[] table

Use popcount() instead in the only calling place.
It is used only at initialization so there is no
speed regression and anyhow even initialization
itself is not slowed down: magic bitboard setup
stays around 175 msec on my slow 32bit Core Duo.

No functional change.
Move all Contempt Factor code to search.cpp

Where it is used.

No functional change.
Set TT size to 32 MB during 'bench'

On some platforms 128 MB of RAM for TT is too much,
so run 'bench' with the default 32 MB size.

No functional change although of course now 'bench'
reports a different number: 5545018
Document why is safe ttValue == VALUE_NONE

We can have ttValue == VALUE_NONE when we use a TT
slot to just save a position static evaluation, but
in this case we also save DEPTH_NONE so to avoid
using the ttValue in search. This happens to work,
but due to a number of lucky and tricky cases that
we now documnet through a bunch of asserts and a
little change to value_from_tt() that has no real
effect but clarifing the code.

No functional change.
Fix Makefile for PowerPC with prefetch enabled

Existing Makefile is buggy for PowerPC, it has no
SSE, yet it is given it if Prefetch is enabled,
because it isn't ARMv7.

Patch from Matthew Brades.

No functional change.
Further improve compatibility when compiling on OS X

Change the minimum supported version from 10.6 to 10.0
Merge pull request #33 from daylen/master

Further improve OS X compatibility

Change the minimum supported version from 10.6 to 10.0

No functional change.

Fix compatibility with old Windows 95 and 98

Report and patches by bnemias.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Contempt factor: use DrawValue also in case of stealmates

Spotted by Jörg Oster.

No functional change (when contempt factor is not used).
Move RootColor from Eval to Search

No functional change.
Use self-describing constants instead of numbers

And remove now useless comments.

No functional change.
Change NO_PIECE value and shrink PieceValue[]

This requires changing color_of() definition.

No functional change.
Don't need to init board[] with NO_PIECE

Now that NO_PIECE == 0 the common memset() will
do the work.

No functional change.
Don't copy a full Position object in print()

Function move_to_san() requires the Position to be
passed by referenced because a do/undo move is done
inside the function to detect a possible mate and to
add to the san string the corresponding '#' suffix.

Instead of passing a copy of current position pass
directly the original position object after const
casting it. This has the advantage to avoid a costly
Position copy, on the down side a bench test could
report different searched nodes if print(move) is
used, due to the additionals do_move() calls.

No functional change.
Retire refine_eval()

Inline its content and better comment what it does through
some renaming.

No functional change.
Merge remote-tracking branch 'upstream/master' into dgt