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

498 commits

Author SHA1 Message Date
Marco Costalba
86c20416c8 Remove some useless casts
No functional change.
2014-04-27 11:44:16 +02:00
Marco Costalba
cb4ac4221e Speed up by almost 3%
This apparentely silly tweak allows
to speed up the bench by almost 3%.

Not clear why, repeating with perft,
the speed up vanishes.

Suggested by Jonathan Calovski.

No functional change.
2014-04-27 00:25:47 +02:00
Marco Costalba
223ebe7b40 Streamline implementation of Position::pretty()
Simpler and more in line with Bitboards::pretty()

No functional change.
2014-04-21 11:47:01 +02:00
Marco Costalba
64d29a6330 Sync some common names
No functional change.
2014-04-06 11:26:12 +02:00
Marco Costalba
5f12069cbf Retire operator|(File f, Rank r)
Use make_square() instead. Less fancy but
more clear.

No functional change.
2014-03-22 23:54:18 +01:00
Marco Costalba
6e4b4c42ed Merge default tests in pos_is_ok
No functional change.
2014-03-15 15:34:31 +01:00
Marco Costalba
142874b058 Microptimize castling in undo_move()
We don't need to set 'captured' and 'pt' after we
castle back.

No functional change.
2014-03-15 11:47:30 +01:00
Marco Costalba
1f4798a173 Further work in pos_is_ok()
No functional change.
2014-03-14 09:43:19 +01:00
Marco Costalba
6571acffaa Reformat do_castling()
No functional change.
2014-03-13 12:53:03 +01:00
Marco Costalba
6f3d787692 Further merge StateInfo setup functions
No functional change.
2014-03-12 22:46:17 +01:00
Marco Costalba
1e032ece92 Merge hash key computation functions
No functional change.
2014-03-12 09:14:38 +01:00
Marco Costalba
cc3002ff04 Use std::count in pos_is_ok()
No functional change.
2014-03-11 23:19:47 +01:00
Marco Costalba
c40d4e0133 Small simplification in gives_check
Use switch statement also for normal case.

No speed regression.

No functional change.
2014-03-11 22:58:08 +01:00
Marco Costalba
d2a8ba3299 Simplify pseudo_legal()
Big simplification of pawn move check.

Code has been tested with a brute force approach: for
every position reached during a bench search, the function
has been called for each combinations of Move(from, to)
and verified the result is the same of old code.

Actually this function is very critical becuase is the
one that ensures corrupted TT moves are discarded, so
to properly test it a simple bench is not enough.

Verified also speed is not changed.

No functional chnage.
2014-03-10 08:38:23 +01:00
Marco Costalba
1d1b7df7c6 Rename castling flag to castling right
This is a more conventional naming as
reported also in:

http://chessprogramming.wikispaces.com/Castling+rights

No functional change.
2014-03-08 15:08:55 +01:00
Marco Costalba
708cb311a0 Pass CastlingFlag argument only
Instead of Color and CastlingSide. Change functions API
accordingly.

No functional change.
2014-03-02 13:21:19 +01:00
Marco Costalba
3d8c0f16c2 Rename xxx_to_char() -> to_char()
No functional change.
2014-03-01 22:07:41 +01:00
Marco Costalba
7b0a2f2a90 Update SEE to return a Value
It seems more natural because the actual returned
value is from PieceValue[] array.

No functional change.
2014-02-16 13:06:31 +01:00
Marco Costalba
d91079d4b0 Fix material key for King
Currently king has no material key associated because
it can never happen to find a legal position without
both kings, so there is no need to keep track of it.

The consequence is that a position with only the two
kings has material key set at zero and if the material
hash table is empty any entry will match and this is
wrong.

Normally bug is hidden becuase the checking for a draw
with pos.is_draw() is done earlier than evaluate() call,
so that we never check in gameplay the material key of a
position with two kings.

Nevertheless the bug is there and can be reproduced setting
at startup a position with only two kings and typing
'eval' from prompt.

The fix is very simple: add a random key also for the king.

Also fixed the condition in material.cpp to avoid asserting
when a 'just 2 kings' postion is evaluated.

No functional change.
2014-02-16 11:51:30 +01:00
Henri Wiechers
ddeb01612b Faster handling of king captures in Position::see
Another SEE speed up that passed the SPRT short TC test!

LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 81337 W: 15060 L: 14745 D: 51532

No functional change.
2014-02-09 19:42:24 +01:00
Henri Wiechers
a08a21d5a0 Small simplification to Position::see
Verified there are no hidden bugs and is
actually a speed optimization:

Fixed games at 15+0.05 TC
ELO: 1.72 +-2.9 (95%) LOS: 87.5%
Total: 20000 W: 3741 L: 3642 D: 12617

No functional change
2014-01-19 11:16:34 +01:00
Henri Wiechers
db05b1f9f5 Rename Position::hidden_checkers to check_blockers
No functional change.
2014-01-12 04:10:46 +09:00
Henri Wiechers
262c380c4b Position::gives_check - use ci.ksq
Also remove a couple of local variables while
there.

No functional change.
2014-01-09 07:38:04 +09:00
Marco Costalba
a646f74e6a Assorted grammar fixes
Mainly from Lyudmil Antonov and
one from Henri Wiechers and Louis Zulli.

No functional change.
2014-01-07 14:30:41 +09:00
Marco Costalba
c9dcda6ac4 Update copyright year
No functional change.
2014-01-02 01:49:18 +01:00
Henri Wiechers
082fbf4264 Remove asymmThreshold stale comment
No functional change.
2013-12-30 10:34:20 +01:00
Marco Costalba
f7742669cb Retire asymmThreshold
Verified with 40K games at long TC does not regress:
ELO: 1.74 +-1.9 (95%) LOS: 96.2%
Total: 39624 W: 6402 L: 6203 D: 27019

bench: 7762310
2013-12-30 01:27:57 +01:00
Arjun Temurnikar
431c3ac485 Even more spelling fixes
No functional change.
2013-12-06 09:03:24 +01:00
Marco Costalba
2408243cf4 Shrink Position::is_draw()
No functional change.
2013-12-03 11:40:31 +01:00
Marco Costalba
342fd6385b Remove redundant argument from hidden_checkers()
No functional change.
2013-12-03 11:15:39 +01:00
Marco Costalba
e6c9ce6358 Small improvment to Position::fen()
No functional change.
2013-12-03 10:53:21 +01:00
Jerry Donald
a8af78c833 Another round of spelling fixes
And also renamed a loop variable while there.

No functional change.
2013-12-02 23:51:29 +01:00
Richard Lloyd
13a73f67c0 Big assorted spelling fixes
No functional change.
2013-12-02 20:29:35 +01:00
Marco Costalba
f99cb3dc27 Rename CASTLE to CASTLING
It is call 'castling move', not 'castle move'

Noticed while reading DiscoCheck sources.

No functional change.
2013-12-01 11:16:47 +01:00
Marco Costalba
dd4e5db2be Simplify a condition in gives_check()
Now that aligned() is quite fast we can skip
some logic.

No functional change.
2013-12-01 10:09:30 +01:00
Marco Costalba
5f2bf91ad1 Rename Bitboards print to pretty
To align to same named Position function and
avoid using std::cout directly.

Also remove some stale <iostream> include while
there.

No functional change.
2013-11-30 11:32:49 +01:00
Marco Costalba
034a2b04f2 Rewrite some bitboard init code
And move the static function Position::attacks_from() to
bitboard code renaming it attacks_bb()

No functional change.
2013-11-30 11:02:56 +01:00
Marco Costalba
1d18647e73 Rename squares_aligned()
Rename to the shorter but still
clear aligned()

No functional change.
2013-11-10 17:14:46 +01:00
Marco Costalba
42caebfaa5 Fix compile in debug mode
No functional change.
2013-11-09 18:41:51 +01:00
Gary Linscott
13d1f0ae43 Restrict mobility of pinned pieces
Passed both short TC:
LLR: 3.00 (-2.94,2.94) [-1.50,4.50]
Total: 54342 W: 10950 L: 10692 D: 32700

And long TC:
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 61976 W: 10654 L: 10251 D: 41071

This patch introduces a slowdown of 3.5 % !!!!!

bench: 7911558
2013-11-07 22:26:03 +01:00
Marco Costalba
549b5c478f Remove unuseful optimization in RKISS
Don't need a struct here. Speed test shows
result is teh same. Moreover RKISS is used
mainly at startup to compute magics, so
prefer to keep it simple...RKISS ;-)

Also some assorted triviality while there.

No functional change.
2013-10-13 03:35:17 -07:00
Lucas Braesch
7f142d6817 Use prefix operators wherever possible
No functional change.
2013-10-05 18:10:43 +02:00
Marco Costalba
cca34e234c Drop 'is' prefix from query functions
Most but not all.

No functional change.
2013-09-28 06:47:59 -07:00
Kojirion
a71209868b Use pre-increment also for native types
Now that we use pre-increment on enums, it
make sense, for code style uniformity, to
swith to pre-increment also for native types,
although there is no speed difference.

No functional change.
2013-09-15 09:17:21 +02:00
Marco Costalba
7a1ff6d8ff Fix operator++ definition
ENABLE_OPERATORS_ON has incorrect definitions of
post-increment and post-decrement operators.

In particularly the returned value is the variable
already incremented/decremented, while instead they
should return the variable _before_ inc/dec.

This has no real effect because are only used in loops
and where the returned value is never used, neverthless
it is wrong. The fix would be to copy the variable to a
dummy, then inc/dec the variable, then return the dummy.

So instead, rename to pre-increment that can be implemented
without the dummy, actually the current implementation
it is already the correct pre-increment, with the only change
to return a reference (an l-value) and not a copy, so
to properly mimic the pre-increment on native integers.

Spotted by Kojirion.

No functional change.
2013-09-15 09:09:06 +02:00
Marco Costalba
27f2ce8f6e Revert "Move draw by material check"
Possible regression

bench: 4554579
2013-09-12 08:44:11 +02:00
Marco Costalba
6ab8b9b6c6 Fix some comments in position.cpp
No functional change.
2013-09-08 06:28:53 -07:00
Marco Costalba
490f67a3f8 Move draw by material check
It is more natural to test this case among
others material distributions.

No functional change.
2013-09-08 06:11:35 -07:00
Marco Costalba
56d2c3844a Further tweak Position::flip
No functional change.
2013-08-05 14:44:06 +02:00
Marco Costalba
23b6809f3d Rewrite flip() to use FEN string manipulation
Instead of dealing directly with internal parameters
just "flip" the FEN string and set the position from
that.

No functional change.
2013-08-05 12:58:14 +02:00