Don't copy Position in pretty_pv()

Also let do_setup_move() don't reuse same StateInfo so that
we can remove the check about different StateInfo objects
before memcpy() in do_move.

Functional change due to harmless additionals
do_move() / undo_move() steps.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
TTEntry simplification

Now that move is fitted in 16 bits we can simplify TTEntry.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Simplify set_option()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Small cleanup in execute_uci_command()

With a little fall out in siblings functions...

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Compile fix in types.h

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Big book.cpp cleanup

Better document PolyGlot formats and greatly
reduce line count.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Set unbuffered I/O also for C standard library

In input_available() we use function select(), so
we have to set as unbuffered also C library I/O
functions otherwise we can miss some input.

For instance in case GUI sends "go infinite\nstop\n" we
parse the "go infinite" but then input_available() under Linux
is unable to detect that we still have "stop" to be processed.

This is because "select" uses file descriptors instead of file
pointers. So it cannot know about the buffer associated to a file
pointer.

This patch, by BB+, should fix the problem.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Fix an hang on 32 bits while allocating big TT table

If size_t is defined as a 32 bit quanitity then we have an
overflow in the left term of the while condition if mbSize
is bigger then 2048.

For instance if mbSize is 2049 then when newSize will reach
0x80000000 (2048MB) comparison is still true, 'while' loops
again and we have an overflow in the expression (2*newSize)
so that result is 0 and at that point 'while' keeps looping
forever hanging the application.

This patch fixes the bug and also makes operator new do not
throw an exception upon failure but return a NULL pointer
instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Initialize killers at ss+2 also in root_search()

After 4955 games:
Mod - Orig: 786 - 768 - 3401 +1 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Simplify from_fen()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Set HistoryMax infinitely high

Respin this old idea. Earlier we tried only
with < 1000 games and result was inconclusive.

After 5845 games
Mod vs Orig: 935 - 936 - 3974 ELO (+-3.6)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Retire HistoryMax

Infact we don't use it anymore already.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Retire history.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Clarify we want Score and Value to be integers

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Move Min() and Max() macros to types.h

As usual a bit of cleanup while there...

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Partially restore HistoryMax

Should be not useful but better safe than sorry.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Fix a warning with __popcnt64() intrinsics

Returns an int64_t while we want a simple int.

This occurs only when compiling with MSVC on a 64 bit platform.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Last touches in history.h

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Move fail loops out of root_search() to id_loop()

And sync root_search() with search()

After 9384 games Mod - Orig:
1532 - 1433 - 6419  ELO +3 (+- 2.8)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Sync root_search() with search()

This will let unification easier.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>