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

93 commits

Author SHA1 Message Date
Marco Costalba
c852a94009 Movegen: further simplify generate_move_if_legal
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:33 +02:00
Marco Costalba
8be2c483a1 Unify black and white code in generate_move_if_legal()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:33 +02:00
Marco Costalba
158911425b Space inflate movegen.cpp
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:33 +02:00
Marco Costalba
cf8ee79b76 Movepick: add and use find_best_index() helper
This removes a bunch of redundant code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:33 +02:00
Marco Costalba
06d6468ce9 Test with see
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:33 +02:00
Marco Costalba
173ecc0acf Use MVV to score captures when see >=0
This fix a couple of dubious bugs in MVV/LVA
ordering.

Tests seems to confirm now is slightly better.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:32 +02:00
Marco Costalba
2943e1ca31 MovePicker: use const reference instead of pointers
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:32 +02:00
Marco Costalba
486ec580f9 Space inflate movepick.cpp
Also added some FIXME to dubious points.

Still no functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:32 +02:00
Marco Costalba
a930aafce0 Better comment previous patch
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:32 +02:00
Marco Costalba
b3744eb4d0 Always add psqt scoring
When there is also history, history is always
preferred.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:32 +02:00
Marco Costalba
a03ab94f44 Shortcut sorting when no move is in history
An alternative algorithm to psqt scoring.

Still unclear what is the best, more tests needed.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:20 +02:00
Marco Costalba
644db060ae Add psqt ordering when there is no history
This seems to increase strenght (about 15 ELO),
still to test some variations on this theme that
could increase ELO even more.

Idea from Rebel (http://members.home.nl/matador/chess840.htm)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-15 07:18:05 +01:00
unknown
cb76e4a814 Introduce Stockfish
Signed-off-by: unknown <Marco@.(none)>
2008-10-13 22:45:47 +01:00
Marco Costalba
d8268024a9 Implement Last Seconds Noise (LSN) filtering
When an engine is in deep trouble at few
seconds from time limit then giveup without
fighting anymore.

This is used to reduce "lucky draws" and time pressure
blunders noises that can obfuscate results during tests
blitz games (typical one minute games).

Goal of this technique is to reduce number of matches
needed to reliably prove then an engine A is stronger
then an opponent B.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-13 20:40:48 +02:00
Marco Costalba
4fa5dd4db5 Add a second margin to razoring
Razor on ply one if the advantage is more then a pawn,
the only way to gap the advantage is to capture, so
go directly in quiesce.

This seems to have a positive effect.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-13 20:40:47 +02:00
Marco Costalba
58c7a5c477 Workaround a static data member bug in MSVC
Without this patch MSVC crashes when compiled
in release mode. It survives and works as
expected in debug mode and with gcc and Intel
compilers.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-13 20:40:47 +02:00
Marco Costalba
3901affb1d Yet another pop_1st_bit() optimization
Always for 32 bit but withot relying on MSVC intrinsics.

It is very similar to previous ones, but this does not
segfaults due to -fno-strict-aliasing compiler option.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-12 14:34:54 +02:00
Marco Costalba
a6017aa728 Add mean calculation in debug tools
Another simple performance counter...

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-11 19:25:16 +02:00
Marco Costalba
6a15df1d82 Revert bad capture pruning
After testing does not seem to increase ELO.

Indeed Glaurung is a little bit weaker, so revert.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-11 19:03:59 +02:00
Marco Costalba
bbf7a94d76 Better interface to get the current move type
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-06 05:44:23 +02:00
Marco Costalba
a3477af2a1 Allow to prune bad captures
Only good capture are preserved from futility pruning
and LMR reducing.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-06 05:44:23 +02:00
Marco Costalba
310e07f292 Teach MovePicker::get_next_move() to return move type
This will be used in future patches.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-06 05:44:22 +02:00
Marco Costalba
ea7bebb604 Fix single digit day in engine_name()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-05 10:37:05 +02:00
Marco Costalba
54071312f3 Add dbg_before() and dbg_after()
Other two debug utilities to compute filter rate.

Usage is:

dbg_before(); // counts passages from this point

if(..) // complex code stuff you want to audit
  return/continue
if(...)
  .....

dbg_after(); // counts passages from this point

Then somewhere in the code, normally in poll() add
dbg_print_hit_rate() and you will see the filter rate
of your code under auditing.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-04 10:01:54 +02:00
Marco Costalba
849809e97e Space inflate Position::to_fen()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-04 09:50:19 +02:00
Marco Costalba
e9e51da4b8 position.cpp: fix a typo introduced by recent patch
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-28 10:59:20 +02:00
Marco Costalba
f1f887b6d7 Use relative values in piece square tables
So that will be automatically changed when
pieces values change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-28 10:59:08 +02:00
Marco Costalba
88bb3c9422 Start to cleanup position.cpp
Still a lot to do. No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-28 10:58:56 +02:00
Marco Costalba
8d76de820f Add dbg_hit_on_c(c, x) tool
Like dbg_hit_on(x) but first filter out events and
only when condition 'c' is true the hit counter
is tested with 'x'.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-28 10:58:47 +02:00
Marco Costalba
b00abed181 Space inflate evaluate_king()
This is the most complex piece of software
so far.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
2e3faae067 Clarify difference between king zone and adjacent zone
There are subtle differences in the king evaluation
that should be clear to avoid misunderstandings.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
453e815d4b Tidy up quick_evaluate()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
3e0dc9ee84 Tidy up middle game specific evaluation
Also add starting position to benchmarks.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
597ef38c39 Code style massage evaluate()
No functional changes.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
d6618d7325 Add auto configuration for 32/64 bits
Instead of manually adjust defines in bitboard.h
now proper ones are automatically set.

It is anyhow possible to still set them manually
in case of problems.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-25 07:51:56 +02:00
Marco Costalba
3ee3cdc09b Evaluate: weight_option() is static
Declare function under local namespace. This removes a
warning from the picky Intel compiler.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:17:28 +02:00
Marco Costalba
ca891e9760 Cleanup read_weights() in evaluate.cpp
Exception to 80 colums rule here, but result
seems better.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:16 +02:00
Marco Costalba
dfcfed6432 Evaluate: rename king attack variables
A better naming IMHO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:15 +02:00
Marco Costalba
34ca22486a Further cleanup evaluate()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:15 +02:00
Marco Costalba
f56af8e84d Rename pawn_rank() in relative_rank()
It is more clear, at last for me.

Also cleanup evaluate_rook() and evaluate_queen()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:15 +02:00
Marco Costalba
3263ee8557 Add also outposts evaluation in common code
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:14 +02:00
Marco Costalba
853ce65f17 Group common evaluate code
This removes code redundancy but perhaps
impact performance due to uninlining.

Testing for regression is needed. For now
aim to best code readibility.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:14 +02:00
Marco Costalba
7dd0c39714 Warnings termination fest
A bunch of Intel C++ warnings removed, other silent out.

Still few remaining but need deeper look.

Also usual whitespace crap removal noise.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 00:32:53 +02:00
Marco Costalba
060eef4f4e Do not use evaluate() for razoring
Because razoring is reached 10% of times and about 50% of time
first two conditions are met we can save 5% of calls to the fairly
costly evaluate().

On the other side statistics have shown 95% of nodes that pass
the first two razoring conditions pass also the evaluate() test.
So the risk of dropping the third condition seems low enough.

Testing seems to validate this.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-23 23:36:51 +02:00
Marco Costalba
67f975e56b init_eval: small cleanup
Functionality not changed.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-23 08:07:50 +02:00
Marco Costalba
1d8994402b Fix InitKingDanger initialization
Last line was missing.

Also reformat tables constants to be more readable.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-23 08:07:42 +02:00
Marco Costalba
2a3ebc884e Optimize pop_1st_bit() take 2
This time we use MSVC intrinsics that are
C wrappers for Intel assembler 'bsf' instruction.

The speed up in node count is around 3%, probably
it does not worth the effort. Anyway this patch
can be useful at least for documentation purposes.

This optimization covers 32 bit systems only.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-21 22:19:07 +02:00
Marco Costalba
01dd46a309 Change the name to Glaurung clone
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-21 11:51:38 +02:00
Marco Costalba
e5cc6f6b85 Switch to developer version numbering
Also clean up code while there.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-21 11:23:50 +02:00
Marco Costalba
29b01b6d82 Use optimized pop_1st_bit() only under Windows
Under Linux we have a segfault after a random time,
about a couple of minutes while running the benchmark.

This happens both with gcc and icc, and both with O2
and O3 optimizations.

Disable for Linux until we understand what's the deal.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-20 22:19:54 +02:00