1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00
Commit graph

2124 commits

Author SHA1 Message Date
Marco Costalba
2e2f1064ba Introduce and use MovePickerExt
A bit of template magic to restore a proper and readable moves
'while' loop that now is again 'similar' to the one that used
to be in search().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-18 13:30:11 +01:00
Marco Costalba
392c7f2ab6 Unify root_search() step 3
Retire root_search()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-18 13:30:10 +01:00
Marco Costalba
6b8026806c Unify root_search() step 2
Enable the change: now we use search() instead of root_search()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-18 13:29:57 +01:00
Marco Costalba
299bda9ea3 Unify root_search() step 1
Teach search() to behave as a root node if requested.
Just added code, but still no functional change.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-18 13:28:34 +01:00
Joona Kiiski
998845763a Fix very theoretical History corner case
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-17 20:22:10 +01:00
Marco Costalba
842efefcad Sync root_search() with search()
This will let unification easier.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-16 13:45:34 +01:00
Marco Costalba
c17a127c42 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>
2011-01-16 13:45:23 +01:00
Marco Costalba
e06c99cad0 Last touches in history.h
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-15 18:03:43 +01:00
Marco Costalba
04001f776e 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>
2011-01-15 12:05:31 +01:00
Marco Costalba
877b468e3e Partially restore HistoryMax
Should be not useful but better safe than sorry.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-15 11:31:14 +01:00
Marco Costalba
13a42284b6 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>
2011-01-15 11:00:00 +01:00
Marco Costalba
3bb1ab34e4 Clarify we want Score and Value to be integers
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-15 10:37:36 +01:00
Marco Costalba
7faeab0878 Retire history.cpp
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-15 10:02:45 +01:00
Marco Costalba
2052407090 Retire HistoryMax
Infact we don't use it anymore already.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-15 09:30:39 +01:00
Joona Kiiski
d6fdd4f6d9 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>
2011-01-14 19:13:22 +01:00
Marco Costalba
b85bcc039c Simplify from_fen()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-14 12:56:31 +01:00
Marco Costalba
62cd133b3a 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>
2011-01-14 07:27:06 +01:00
Marco Costalba
6442981cb6 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>
2011-01-13 22:03:18 +01:00
Marco Costalba
d4b92ae9a0 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>
2011-01-11 18:58:56 +01:00
Marco Costalba
611a29f767 Big book.cpp cleanup
Better document PolyGlot formats and greatly
reduce line count.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-10 19:55:02 +01:00
Marco Costalba
d84ffc0cfa Compile fix in types.h
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-10 12:54:08 +01:00
Marco Costalba
caa02b0e43 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>
2011-01-09 16:24:30 +01:00
Marco Costalba
a8741bd59f Simplify set_option()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-09 15:15:52 +01:00
Joona Kiiski
06c14d0a37 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>
2011-01-09 13:20:04 +01:00
Marco Costalba
15153a1de7 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>
2011-01-09 12:55:22 +01:00
Marco Costalba
c89762288b Merge line_to_san() into pretty_pv()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 18:31:14 +01:00
Marco Costalba
b4acf83704 Ressurect move.cpp
Actually it is san.cpp renamed. Because now has the move
conversions functions and doesn't have any more the bulky
move_from_san(), it is better to call it move.cpp

Remove san.h while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 17:52:02 +01:00
Joona Kiiski
ee0afea1e5 Fix build failure under Linux
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 16:26:55 +01:00
Marco Costalba
c82906a2c3 Retire move_from_san()
It is unused and it is big.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 16:23:46 +01:00
Marco Costalba
6b49d509a1 Greatly simplify move_from_uci()
Use a reverse logic: among the list of generated legal moves
transformed in UCI coordinate notation find the one that
matches the given string.

It is a bit slower, but here is not performance critical and
is much more simplified then before.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 16:12:42 +01:00
Marco Costalba
82d5386435 Move uci move parsing under san.cpp
This partially reverts 1e7aaed8bc keeping the conversion
functions from/to move to uci string in the same file.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 15:53:49 +01:00
Joona Kiiski
f4b4d4901c Change Emergency time maximum from 60000 to 30000
I got report from Werner that Shredder Gui has problems with
UCI values which maximum value is greater than 30000.

Of course it's stupid to change engine to fix a GUI's bug,
but on the other hand 30000 ms as maximum value is clearly enough,
so why not to be merciful

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 14:27:11 +01:00
Joona Kiiski
8d86e95e37 Fix Makefile's GPL-notice to be similar to other files
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 14:26:59 +01:00
Marco Costalba
0f81f97bb6 Improve I/O responsivness
Added checking of (stdin->_cnt > 0) from Greko.

This seems to greatly improve responsivness when running
under console. Now while running a 'stockfish bench', any key
press immediately is detected by SF while before there was a
delay of some fraction of a second.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 14:17:41 +01:00
Marco Costalba
d9b96f0e49 Fix reading a book under-promotion move
This is an old Glaurung bug that prevented a Polyglot
book move to be read correctly in case of underpromotion.

This patch fixes the bug restoring support for both
queen and underpromotions.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 13:23:25 +01:00
Marco Costalba
4fa0395eb8 Triviality in data_available()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-08 12:53:41 +01:00
Marco Costalba
b3545737fa Force inlining of move generation functions
MSVC (and possibly other compilers) does not inline
as requested, so force it to do so.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-07 16:57:15 +01:00
Marco Costalba
44fbbeafc9 Small tweak to generate_castle_moves()
Move the castling condition test out of the
function. This avoids a function call most of
the times.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-07 16:57:14 +01:00
Marco Costalba
57b3ca916f Unify move generation
Functional change due only to moves reorder. Anyhow after
5242 games at 15"+0.1 TC verified we have no regression.

Mod vs Orig 994 - 958 - 3290 +2 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-07 16:56:42 +01:00
Marco Costalba
12f4bbc8f2 Templetize move generation API
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-07 14:46:29 +01:00
Marco Costalba
1e7aaed8bc Retire move.cpp
Move its functions where they belong.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-07 13:40:13 +01:00
Marco Costalba
a46b53e1c2 Use 16 bits to store a move instead of 17
Shrink of 1 bit so to fit a move in an uint_16 and
possibly a MoveStack in an uint_32.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-07 12:13:05 +01:00
Marco Costalba
dcbc8a7e75 Use a 32 bit bitwise 'and' in SimpleHash lookup
A bit faster on 32 bits machines, more similar to
TranspositionTable::first_entry() and same result.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-07 11:25:13 +01:00
Marco Costalba
0ddf84870a Introduce SimpleHash class
And use it for pawns and material infos.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-07 11:20:49 +01:00
Marco Costalba
803c8e0be3 Small tidy up of inttypes for Windows
There was a strange "int16" type and "int64_t"
was defined twice.

Spotted by Joona.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-06 23:28:06 +01:00
Joona Kiiski
fca74b1882 Simplify 50 move rule condition
We never reach a position where rule50 > 100.
When rule50 == 100, it's either draw or mate and
there is no way search could go deeper.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-06 14:46:49 +01:00
Joona Kiiski
b08ba446f6 Clean up position setup code
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-06 13:54:03 +01:00
Joona Kiiski
1a20d72701 Parse halfmove clock and fullmove number from FEN
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-06 13:44:11 +01:00
Joona Kiiski
916c0cbfbc Minimal restructuring of value.h
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-06 13:36:02 +01:00
Marco Costalba
2e46db4369 Do not make any assumption on the move in move_is_legal()
We must be able to filter out also moves where move_is_ok()
is false.

And actually we are. Tested on all the default position injecting
a number from -1000000 to 1000000 casted to a Move.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-06 13:33:40 +01:00