stockfish
11 years agoRetire Application class
Marco Costalba [Mon, 22 Nov 2010 13:55:56 +0000 (14:55 +0100)]
Retire Application class

It is a redundant boiler plate, just call initialization and
resource release directly from main()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire piece.cpp
Marco Costalba [Mon, 22 Nov 2010 10:50:58 +0000 (11:50 +0100)]
Retire piece.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUCI options names should not be case sensitive
Marco Costalba [Sun, 21 Nov 2010 22:28:17 +0000 (23:28 +0100)]
UCI options names should not be case sensitive

Correctly handle uci option names in a case insensitive way.

Alos fix some indentation while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire "New Game" UCI option
Marco Costalba [Sun, 21 Nov 2010 13:23:16 +0000 (14:23 +0100)]
Retire "New Game" UCI option

Was introduced by 403db5a6e9f
on 1/12/2009 to correctly handle "loose on time"
LSN filtering functionality, but is now unused.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRemove hardcoded 16 from benchmark default positions size
Marco Costalba [Sun, 21 Nov 2010 12:06:53 +0000 (13:06 +0100)]
Remove hardcoded 16 from benchmark default positions size

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMicro-optimize pl_move_is_legal()
Marco Costalba [Sun, 21 Nov 2010 11:43:16 +0000 (12:43 +0100)]
Micro-optimize pl_move_is_legal()

This L1/L2 optimization has an incredible +4.7% speedup
in perft test where this function is the most time consumer.

Verified a speed up also in normal bench, although smaller.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoStore "true" and "false" in bool options
Marco Costalba [Sat, 20 Nov 2010 13:23:28 +0000 (14:23 +0100)]
Store "true" and "false" in bool options

UCI protocol uses "true" and "false" for check and button types,
so store that values instead of "1" and "0", this simplifies a
bit the code.

Also a bit strictier option's type checking in debug mode.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDebug counters don't need to be global
Marco Costalba [Sat, 20 Nov 2010 10:48:04 +0000 (11:48 +0100)]
Debug counters don't need to be global

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSmall touches to engine_name()
Marco Costalba [Fri, 19 Nov 2010 16:03:44 +0000 (17:03 +0100)]
Small touches to engine_name()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse occupied_squares() in book_key()
Marco Costalba [Tue, 16 Nov 2010 18:28:09 +0000 (19:28 +0100)]
Use occupied_squares() in book_key()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRearrange pawn moves generation
Marco Costalba [Tue, 16 Nov 2010 08:42:12 +0000 (09:42 +0100)]
Rearrange pawn moves generation

This patch greatly cleanups generation of pawn moves but
we change the order in which moves are generated so there is
a change in functionality, but not in perft.

The only real functionality change is that now when type == CHECK
we generate knight underpromotion captures only if give check and
not always as before.

Perft is 2% faster and fully verified.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoIntroduce generate_promotions()
Marco Costalba [Tue, 16 Nov 2010 07:51:07 +0000 (08:51 +0100)]
Introduce generate_promotions()

A bit ugly to guarantee no functional change.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSimplify generate_pawn_captures()
Marco Costalba [Mon, 15 Nov 2010 15:27:05 +0000 (16:27 +0100)]
Simplify generate_pawn_captures()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoCleanup Bioskey()
Marco Costalba [Mon, 15 Nov 2010 12:49:13 +0000 (13:49 +0100)]
Cleanup Bioskey()

And rename in dataAvailable()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoLet bench to have full defaults arguments
Marco Costalba [Mon, 8 Nov 2010 19:49:40 +0000 (20:49 +0100)]
Let bench to have full defaults arguments

Now stockfish bench' defaults to

stockfish bench 128 1 12 default depth

that is the most used line (at least by me)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoVarious cleanup in book.cpp
Marco Costalba [Mon, 8 Nov 2010 14:30:12 +0000 (15:30 +0100)]
Various cleanup in book.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoLet benchmark to default to depth 12
Marco Costalba [Mon, 8 Nov 2010 10:08:01 +0000 (11:08 +0100)]
Let benchmark to default to depth 12

And also simplify a lot the code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMove PieceValue[] and SlidingArray[] where they belong
Marco Costalba [Mon, 8 Nov 2010 08:44:28 +0000 (09:44 +0100)]
Move PieceValue[] and SlidingArray[] where they belong

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoAllow split point master to sleep (take 2)
Marco Costalba [Sun, 7 Nov 2010 22:45:13 +0000 (23:45 +0100)]
Allow split point master to sleep (take 2)

Let to sleep even split point master, it will be waken
up by its slaves when they return from the search.

This time let it be enabled by an UCI option, so
people is free to test it on their Hyper Thread box.

Option is disabled by default.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse namespace in position.cpp
Marco Costalba [Sun, 7 Nov 2010 12:41:21 +0000 (13:41 +0100)]
Use namespace in position.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire uci.h and benchmark.h
Marco Costalba [Sun, 7 Nov 2010 12:22:13 +0000 (13:22 +0100)]
Retire uci.h and benchmark.h

Moved the single prototipes where are needed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoObject OpeningBook doen't need to be global
Marco Costalba [Sun, 7 Nov 2010 12:12:48 +0000 (13:12 +0100)]
Object OpeningBook doen't need to be global

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMake rkiss seed deterministic
Marco Costalba [Sun, 7 Nov 2010 11:33:17 +0000 (12:33 +0100)]
Make rkiss seed deterministic

Search at fixed depth with one thread must be
reproducible so remove randomess from time().

Also better license description.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoLet rkiss.h to follow SF coding style
Marco Costalba [Sun, 7 Nov 2010 11:11:01 +0000 (12:11 +0100)]
Let rkiss.h to follow SF coding style

Fix also Makefile after mersenne.cpp has been removed

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse Heinz's RKiss instead of marsenne
Marco Costalba [Sun, 7 Nov 2010 10:13:17 +0000 (11:13 +0100)]
Use Heinz's RKiss instead of marsenne

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix an off by one bug in print_uci_options()
Marco Costalba [Fri, 5 Nov 2010 12:59:48 +0000 (13:59 +0100)]
Fix an off by one bug in print_uci_options()

Last option was not printed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire bitbase.h
Marco Costalba [Fri, 5 Nov 2010 12:53:13 +0000 (13:53 +0100)]
Retire bitbase.h

Moved the only prototipe where is needed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRewrite options handling in an object oriented fashion
Marco Costalba [Thu, 4 Nov 2010 07:03:27 +0000 (08:03 +0100)]
Rewrite options handling in an object oriented fashion

Big rewrite and about 100 lines removed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire push_button() and button_was_pressed()
Marco Costalba [Wed, 3 Nov 2010 08:32:14 +0000 (09:32 +0100)]
Retire push_button() and button_was_pressed()

Directly access the underlying bool option.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoPrefer int to uint8_t when possible
Marco Costalba [Mon, 1 Nov 2010 12:16:32 +0000 (13:16 +0100)]
Prefer int to uint8_t when possible

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoAdd "mingw" compiler to Makefile
Marco Costalba [Mon, 1 Nov 2010 11:17:54 +0000 (12:17 +0100)]
Add "mingw" compiler to Makefile

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix MinGW warnings
Marco Costalba [Mon, 1 Nov 2010 10:44:46 +0000 (11:44 +0100)]
Fix MinGW warnings

I finally got SF to compile under MinGW (after adding pthread libraries)
and here are the fixed warnings.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoAllocate RootPosition on the stack
Marco Costalba [Sun, 31 Oct 2010 10:37:43 +0000 (11:37 +0100)]
Allocate RootPosition on the stack

And pass it as an argument.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUpdate nodes after a do_move()
Marco Costalba [Sun, 31 Oct 2010 09:55:28 +0000 (10:55 +0100)]
Update nodes after a do_move()

And also store the node counter in Position and not in Thread.
This will allow to properly count nodes also in sub trees with
SMP active.

This requires a surprisingly high number of changes
in a lot of places to make it work properly.

No functional change but node count changed for obvious reasons.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix some icc's "statement is unreachable" warnings
Marco Costalba [Sat, 30 Oct 2010 17:44:34 +0000 (18:44 +0100)]
Fix some icc's "statement is unreachable" warnings

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMove moveCount update near the SpNode case
Marco Costalba [Sat, 30 Oct 2010 17:18:48 +0000 (18:18 +0100)]
Move moveCount update near the SpNode case

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoIntroduce and use TranspositionTable::refresh()
Marco Costalba [Sat, 30 Oct 2010 14:22:10 +0000 (15:22 +0100)]
Introduce and use TranspositionTable::refresh()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse margins[] array in evaluate
Marco Costalba [Sat, 30 Oct 2010 13:22:57 +0000 (14:22 +0100)]
Use margins[] array in evaluate

It will be used by future patches.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMore readable search/qsearch dispatch
Marco Costalba [Sat, 30 Oct 2010 11:31:42 +0000 (12:31 +0100)]
More readable search/qsearch dispatch

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix last leak detected by Valgrind
Marco Costalba [Sun, 24 Oct 2010 08:39:33 +0000 (10:39 +0200)]
Fix last leak detected by Valgrind

This was subtle and google was my friend.

The leak was in _dl_allocate_tls called by pthread_create() and
is due to the fact that threads are created in joinable state so that
once terminated are not freed. To make the thread to release
its resources upon termination we should set them in detached state.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix a memcpy() warning under Valgrind
Marco Costalba [Sun, 24 Oct 2010 08:15:31 +0000 (10:15 +0200)]
Fix a memcpy() warning under Valgrind

Fix warning: "Source and destination overlap in memcpy"

This happens when we call multiple time do_move() with the
same state, for instance when we don't need to undo the move.

This is what valgrind docs say:

You don't want the two blocks to overlap because one of them could
get partially overwritten by the copying.

You might think that Memcheck is being overly pedantic reporting this
in the case where 'dst' is less than 'src'. For example, the obvious way
to implement memcpy() is by copying from the first byte to the last.
However, the optimisation guides of some architectures recommend copying
from the last byte down to the first. Also, some implementations of
memcpy() zero 'dst' before copying, because zeroing the destination's
cache line(s) can improve performance.

In addition, for many of these functions, the POSIX standards have wording
along the lines "If copying takes place between objects that overlap,
the behavior is undefined." Hence overlapping copies violate the standard.

The moral of the story is: if you want to write truly portable code, don't
make any assumptions about the language implementation.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRevert previous patch
Marco Costalba [Sun, 24 Oct 2010 08:51:49 +0000 (09:51 +0100)]
Revert previous patch

It seems we have a speed regression under Linux, anyhow
commit and revert to leave some documentation in case we
want to try again in the future.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoAllow split point master to sleep
Marco Costalba [Thu, 21 Oct 2010 06:46:38 +0000 (07:46 +0100)]
Allow split point master to sleep

Let to sleep even split point master, it will be waken up
by its slaves when they return from the search.

With this patch we get maximum HT speedup

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRe-add "Pass evalMargin through SearchStack as eval"
Marco Costalba [Sat, 23 Oct 2010 06:52:17 +0000 (07:52 +0100)]
Re-add "Pass evalMargin through SearchStack as eval"

It has more sense to treat the two evaluation metrics
in the same way.

As a side effect now we use the correct eval margin when
pruning in a SplitPoint node.

No functional change in single thread.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFinally retire sp_search()
Marco Costalba [Sat, 23 Oct 2010 06:38:48 +0000 (07:38 +0100)]
Finally retire sp_search()

Fix the movcount updating bug and let search() to completely
subsititute sp_search().

No functional change even with fakes split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoTemporary restore old sp_search()
Marco Costalba [Mon, 18 Oct 2010 02:29:58 +0000 (04:29 +0200)]
Temporary restore old sp_search()

There is a bug in the conversion that is triggered when testing
with faked split and that I missed somehow :-(

To allow proper testing on cluster restore old sp_search()
until I don't fiugre up what's happened.

Restored to be functional equivalent to old behaviour both in
single thread and in faked split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRevert "Pass evalMargin through SearchStack as eval"
Marco Costalba [Sat, 16 Oct 2010 10:54:44 +0000 (11:54 +0100)]
Revert "Pass evalMargin through SearchStack as eval"

Restore full no functional change also in Faked Split mode.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDon't wake up /sleep threads in think() anymore
Marco Costalba [Sun, 17 Oct 2010 12:12:12 +0000 (13:12 +0100)]
Don't wake up /sleep threads in think() anymore

When entering and exiting from think() we don't need any special
wake up / sleeping code because we want available threads to keep
sleeping.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoEnable sleeping of available threads
Marco Costalba [Sun, 17 Oct 2010 10:23:59 +0000 (11:23 +0100)]
Enable sleeping of available threads

This simple patch has devastating consequences ;-)

Now an available thread goes to sleep and is waked up after
being allocated.

This patch allows Stockfish to dramatically increase performances
on HyperThreading systems.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse fast SRWLOCK locks under Windows
Marco Costalba [Sun, 17 Oct 2010 10:01:55 +0000 (11:01 +0100)]
Use fast SRWLOCK locks under Windows

They are fast and also have the same semantic of Linux ones.

This allow to simplify the code and especially to use
SleepConditionVariableSRW() to wait on a condition releaseing the lock,
this has the same semantic as pthread_cond_wait().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRemove some ifdef from wake_sleeping_thread()
Marco Costalba [Sun, 17 Oct 2010 08:34:23 +0000 (09:34 +0100)]
Remove some ifdef from wake_sleeping_thread()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire put_threads_to_sleep()
Marco Costalba [Sun, 17 Oct 2010 08:03:39 +0000 (09:03 +0100)]
Retire put_threads_to_sleep()

Obsoleted by previous patches.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire THREAD_SLEEPING and use THREAD_AVAILABLE instead
Marco Costalba [Sun, 17 Oct 2010 07:57:20 +0000 (08:57 +0100)]
Retire THREAD_SLEEPING and use THREAD_AVAILABLE instead

This is a prerequisite for future work and anyhow removes
a state flag, so it is good anyhow.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire AllThreadsShouldSleep flag
Marco Costalba [Sun, 17 Oct 2010 07:38:52 +0000 (08:38 +0100)]
Retire AllThreadsShouldSleep flag

It is redundant and complicates the already complicated
SMP code for no reason.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDestroy wait conditions before exiting
Marco Costalba [Sun, 17 Oct 2010 07:16:46 +0000 (08:16 +0100)]
Destroy wait conditions before exiting

We already do this for locks. Also rename SitIdleEvent
in WaitCond to be uniform with Lunix naming.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoChange thread API to use one wait condition per thread
Marco Costalba [Sun, 17 Oct 2010 06:55:57 +0000 (07:55 +0100)]
Change thread API to use one wait condition per thread

This is the native way done in Windows and we will use it
for future work, so change Linux to do the same.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDo not shadow SplitPoint struct with search() parameter
Marco Costalba [Sat, 16 Oct 2010 14:24:42 +0000 (15:24 +0100)]
Do not shadow SplitPoint struct with search() parameter

Also retire move_is_killer() is called only from one place.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFixed some warnings when using -Weffc++ gcc option
Marco Costalba [Sat, 16 Oct 2010 11:52:01 +0000 (13:52 +0200)]
Fixed some warnings when using -Weffc++ gcc option

Plus some other icc warnings popped up with new and strictier
compile options.

No functional and speed change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix a shadowed variable warning under icc
Marco Costalba [Sat, 16 Oct 2010 11:19:44 +0000 (13:19 +0200)]
Fix a shadowed variable warning under icc

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire now obsoleted do_sp_search() trampoline code
Marco Costalba [Sat, 16 Oct 2010 11:09:49 +0000 (12:09 +0100)]
Retire now obsoleted do_sp_search() trampoline code

We can call search() directly from idle_loop()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoPass evalMargin through SearchStack as eval
Marco Costalba [Sat, 16 Oct 2010 10:54:44 +0000 (11:54 +0100)]
Pass evalMargin through SearchStack as eval

It has more sense to treat the two evaluation metrics
in the same way.

As a side effect now we use the correct eval margin when
pruning in a SplitPoint node.

No functional change in single thread.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUnify sp_search() and search() step 3
Marco Costalba [Sat, 16 Oct 2010 10:24:03 +0000 (11:24 +0100)]
Unify sp_search() and search() step 3

Remove old sp_search() code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUnify sp_search() and search() step 2
Marco Costalba [Sat, 16 Oct 2010 09:01:45 +0000 (10:01 +0100)]
Unify sp_search() and search() step 2

Modify search() to be able to handle split points

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUnify sp_search() and search() step 1
Marco Costalba [Tue, 12 Oct 2010 08:28:25 +0000 (10:28 +0200)]
Unify sp_search() and search() step 1

Rewrite sp_search() to have same signature of search()

This is the first prerequistite step toward unification.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoPass moveCount by value in split()
Marco Costalba [Tue, 12 Oct 2010 07:54:01 +0000 (09:54 +0200)]
Pass moveCount by value in split()

Actually it is an error to update back moveCount value after split()
because it is used in update_history() to access movesSearched[]
array. But becasue this vector is not updated in the split point
we end up with an access of stale data.

Bug has been hidden til now because we 'forgot' to update
moveCount before returning from split().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSync sp_search() with search()
Marco Costalba [Tue, 12 Oct 2010 08:14:40 +0000 (10:14 +0200)]
Sync sp_search() with search()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoBetter document some threads functions
Marco Costalba [Tue, 12 Oct 2010 07:06:33 +0000 (09:06 +0200)]
Better document some threads functions

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDocument an assert in idle_loop()
Marco Costalba [Mon, 11 Oct 2010 18:56:07 +0000 (19:56 +0100)]
Document an assert in idle_loop()

Thanks to Bruno Causse for the clarification.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse VALUE_DRAW instead of VALUE_ZERO where better
Marco Costalba [Sun, 10 Oct 2010 08:04:09 +0000 (09:04 +0100)]
Use VALUE_DRAW instead of VALUE_ZERO where better

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse do_move_bb() in move_attacks_square()
Marco Costalba [Sun, 10 Oct 2010 06:56:07 +0000 (08:56 +0200)]
Use do_move_bb() in move_attacks_square()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoAnother cleanup in evaluate_pawns()
Marco Costalba [Sun, 10 Oct 2010 05:55:42 +0000 (07:55 +0200)]
Another cleanup in evaluate_pawns()

Suggested by Marek Kwiatkowski.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMicro optimize open files calculation
Marco Costalba [Sat, 9 Oct 2010 14:04:24 +0000 (15:04 +0100)]
Micro optimize open files calculation

Committed mostly because is also a cleanup...

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRearrange pawn penalities arrays
Marco Costalba [Sat, 9 Oct 2010 12:20:49 +0000 (13:20 +0100)]
Rearrange pawn penalities arrays

A clean up that is also a prerequisite for next patches.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSmall codestyle touches
Marco Costalba [Sat, 9 Oct 2010 12:05:58 +0000 (13:05 +0100)]
Small codestyle touches

Mostly suggested by Justin (UncombedCoconut), the 0ULL -> 0 conversion
is mine.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoProperly set to zero stuff returned by 'new'
Marco Costalba [Thu, 7 Oct 2010 02:55:08 +0000 (03:55 +0100)]
Properly set to zero stuff returned by 'new'

Language guarantees that c'tor is called, but without any c'tor
it happens to work by accident because OS zeroes out the freshly
allocated pages. The problem is that if I deallocate and allocate
again, the second time pages are no more newly come by the OS and
so could contain stale info.

A practical case could be if we change TT size or numbers of
threads on the fly while already running.

Bug spotted by Justin Blanchard.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire updateKingTables[]
Marco Costalba [Wed, 6 Oct 2010 07:11:27 +0000 (09:11 +0200)]
Retire updateKingTables[]

Suggested by Marek Kwiatkowski.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSkip ei.kingZone[] initialization together with king safety
Marco Costalba [Tue, 5 Oct 2010 21:22:44 +0000 (22:22 +0100)]
Skip ei.kingZone[] initialization together with king safety

Another microptimization by Marek Kwiatkowski.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSkip an useless compare in space evaluation
Marco Costalba [Tue, 5 Oct 2010 21:10:42 +0000 (22:10 +0100)]
Skip an useless compare in space evaluation

Spotted by Marek Kwiatkowski.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRestore development version
Marco Costalba [Tue, 5 Oct 2010 18:40:49 +0000 (19:40 +0100)]
Restore development version

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoStockfish 1.9.1
Marco Costalba [Tue, 5 Oct 2010 07:23:52 +0000 (09:23 +0200)]
Stockfish 1.9.1

Fix release to workaround chess960 on some GUIs

Signature is:

stockfish bench 128 1 12 default depth

Node counts: 10914593

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix broken chess960 under Shredder GUI
Marco Costalba [Tue, 5 Oct 2010 07:19:40 +0000 (09:19 +0200)]
Fix broken chess960 under Shredder GUI

We need to add a dummy option anyway to make GUIs happy.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRewrite bit counting functions
Marco Costalba [Mon, 4 Oct 2010 09:45:04 +0000 (11:45 +0200)]
Rewrite bit counting functions

Get rid of macros and use templates instead,
this is safer and allows us fix the warning:

ISO C++ forbids braced-groups within expressions

That broke compilation with -pedantic flag under
gcc and POPCNT enabled.

No functional and no performance change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRemove -pedantic option
Marco Costalba [Sun, 3 Oct 2010 13:37:50 +0000 (14:37 +0100)]
Remove -pedantic option

Breaks current POPCNT code.

Perhaps we will readd with a proper fix...

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse special handling for promotions in move_is_legal()
Marco Costalba [Sun, 3 Oct 2010 10:10:08 +0000 (11:10 +0100)]
Use special handling for promotions in move_is_legal()

Simplifies a bit the code and the common case too.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix an obsoleted NO_PIECE_TYPE in a comment
Marco Costalba [Sat, 2 Oct 2010 17:57:46 +0000 (18:57 +0100)]
Fix an obsoleted NO_PIECE_TYPE in a comment

Spotted by Ralph Stoesser.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRestore development version
Marco Costalba [Sat, 2 Oct 2010 13:36:43 +0000 (14:36 +0100)]
Restore development version

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoIncrease warning level
Marco Costalba [Sat, 2 Oct 2010 09:46:18 +0000 (11:46 +0200)]
Increase warning level

Both under gcc and icc: sf compiles with no warnings !

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoStockfish 1.9
Marco Costalba [Sat, 2 Oct 2010 08:55:10 +0000 (09:55 +0100)]
Stockfish 1.9

Signature is:

stockfish bench 128 1 12 default depth

Node counts: 10914593

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoLess aggressive move count based futility pruning
Joona Kiiski [Sat, 3 Jul 2010 21:38:49 +0000 (00:38 +0300)]
Less aggressive move count based futility pruning

This patch from Joona greatly reduces move count pruning,
below is the old and new move count limits starting from
ONE_PLY with half-play increment:

Old: 4,5,5,5, 7, 7,11,11,11,19,19,19,35,35
New: 4,5,7,9,12,15,19,23,28,33,39,45,52,59

Surprisingly results are even a bit better at a quite
fast time control.

After 5260 games at 30"+0.1
Mod - Orig:  864 - 806 - 3590  ELO +3 (+- 3.8)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix handling of 50 move rule and remove a fixme
Marco Costalba [Sat, 25 Sep 2010 10:21:24 +0000 (11:21 +0100)]
Fix handling of 50 move rule and remove a fixme

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoShrink OutpostBonus[] definition
Marco Costalba [Sat, 25 Sep 2010 10:12:55 +0000 (11:12 +0100)]
Shrink OutpostBonus[] definition

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSimplify scale factors implementation
Marco Costalba [Fri, 24 Sep 2010 08:33:16 +0000 (10:33 +0200)]
Simplify scale factors implementation

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRename no_mob_area in mobilityArea
Marco Costalba [Fri, 24 Sep 2010 07:43:48 +0000 (09:43 +0200)]
Rename no_mob_area in mobilityArea

It is the correct name.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSmall code style in qsearch
Marco Costalba [Tue, 21 Sep 2010 12:40:10 +0000 (14:40 +0200)]
Small code style in qsearch

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDo not update killers in qsearch
Marco Costalba [Tue, 14 Sep 2010 08:39:12 +0000 (10:39 +0200)]
Do not update killers in qsearch

It seems totally unuseful because killers are not
used to order the moves in qsearch. Although there
is some functionality change, probably just a small
side effect.

After 5656 games on rc
Mod vs Orig: 1007 - 980 - 3669  ELO +1 (+- 3.7)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoA king move can never have negative SEE
Marco Costalba [Sun, 19 Sep 2010 12:52:01 +0000 (13:52 +0100)]
A king move can never have negative SEE

So there is no need to explicitly check for king moves
when detecting prunable evasions.

Perhaps teoretically a very bit slower (I didn't test),
but it is more clear now what evasions we consider prunable.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSimplify SEE
Marco Costalba [Sun, 19 Sep 2010 12:41:01 +0000 (13:41 +0100)]
Simplify SEE

Greatly cleanup SEE code and now it is also a bit
faster on gcc, about +0.6%.

Thanks to Mike Whiteley new SEE code that gave me
fresh ideas on how to cleanup this old stuff.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire NullMoveMargin
Marco Costalba [Sun, 12 Sep 2010 11:38:38 +0000 (12:38 +0100)]
Retire NullMoveMargin

A code semplification that could even be a slight increase,
anyhow is a reducing pruning patch, so it is good even
at equal strenght.

After 6342 games
Mod - Orig:  1040 - 974 - 4328  ELO +3 (+- 3.5)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoWe need just one eval margin in search
Marco Costalba [Tue, 14 Sep 2010 08:57:48 +0000 (10:57 +0200)]
We need just one eval margin in search

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoReintroduce rook contact checks
Marco Costalba [Sun, 12 Sep 2010 10:39:38 +0000 (11:39 +0100)]
Reintroduce rook contact checks

Were removed when merged from Glaurung 2.2, but without
any test.

Note that weight has been increased from original 2 to 4 and
has been also fixed a bug where in the original version were
considered also diagonal sqaures for the rook, that are
contact squares but not checks.

After 4449 games at 30"+0.1
Mod - Orig:  717 - 649 - 3083  ELO +5 (+- 4.1)

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