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

31 commits

Author SHA1 Message Date
Marco Costalba
94b9c65e09 Introduce enum VALUE_ZERO instead of Value(0)
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-08-19 13:48:38 +01:00
Marco Costalba
5ee7dfebf7 Fix KBNK endgame
Broken by recent patch. Also better document what's
happening there.

Verified to restore original behaviour.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-07-25 21:58:09 +01:00
Marco Costalba
9b1d5bd534 Introduce and use same_color_squares()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-07-25 11:49:32 +01:00
Marco Costalba
53bbcb78d5 Triviality in endgame.cpp
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-07-17 14:00:25 +01:00
Marco Costalba
83631c89ce Endgame's apply() method can be 'const'
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-04-27 06:17:32 +01:00
Marco Costalba
9fc602bae7 Updated copyright year to 2010
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-03-20 11:27:07 +01:00
Marco Costalba
e4277c06bf Rename piece_attacks_from() in attacks_from()
It is in line with attackers_to() and is shorter and
piece is already redundant because is passed as template
parameter anyway.

Integrate also pawn_attacks_from() in the attacks_from()
family so to have an uniform attack info API.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-09-20 14:55:28 +01:00
Marco Costalba
6845397c5c Rename piece_attacks() in piece_attacks_from()
It is a bit longer but much easier to understand especially
for people new to the sources. I remember it was not trivial
for me to understand the returned attack bitboard refers to
attacks launched from the given square and not attacking the
given square.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-09-20 10:26:54 +01:00
Marco Costalba
049139d025 Change pawn_attacks() API
Instead of pawn_attacks(Color c, Square s) define as
pawn_attacks(Square s, Color c) to be more aligned to
the others attack info functions.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-09-20 09:09:27 +01:00
Marco Costalba
9f28d8a854 Second take at unifying bitboard representation access
This patch is built on Tord idea to use functions instead of
templates to access position's bitboards. This has the added advantage
that we don't need fallback functions for cases where the piece
type or the color is a variable and not a constant.

Also added Joona suggestion to workaround request for two types
of pieces like bishop_and_queens() and rook_and_queens().

No functionality or performance change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-09-04 08:21:06 +01:00
Marco Costalba
76bed11f7b Templetize functions to get pieces by type
Use a single template to get bitboard representation of
the position given the type of piece as a constant.

This removes almost 80 lines of code and introduces an
uniform notation to be used for querying for piece type.

No functional change and no performance change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-09-04 08:21:05 +01:00
Marco Costalba
bfd4421f49 Better naming and document some endgame functions
In particular the generic scaling functions.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-08-14 08:19:55 +01:00
Marco Costalba
aa925a0e29 There is no need to special case KNNK ending
It is always draw, so use the corresponding proper
evaluation function.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-08-08 13:10:10 +01:00
Marco Costalba
297c12e595 Simplify endgame functions handling
We really don't need to have global endgame functions. We can
allocate them on the heap at initialization time and store the
corresponding pointer directly in the functions maps. To avoid
leaks we just need to remember to deallocate them in map d'tor.

These functions are always created in couple, one for each color,
so remove a lot of redundant hard coded info and just use the minimum
required: the type and the corresponding named string.

This greatly simplifies the code and also it is less error prone,
now is much simpler to add a new endgame specialized function: just
add the corresponding enum in endgame.h and the obvious add_xx()
call in EndgameFunctions c'tor, and of course, the most important part,
the EvaluationFunction<xxx>::apply() specialization in endgame.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-17 07:55:51 +01:00
Marco Costalba
76024ac40e Use compiler name lookup to simplify code
We don't need different names between a function and a
template. Compiler will know when use one or the other.

This let use restore original count_1s_xx() names instead of
sw_count_1s_xxx so to simplify a bit the code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-24 10:18:31 +01:00
Marco Costalba
3376c68f4b Introduce bitcount.h
It will be used for POPCNT intrinsics.

For now no bianry and functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-21 16:19:20 +02:00
Marco Costalba
5c81602d14 Update copyright year
We are well in 2009 already.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-07 14:54:40 +02:00
Marco Costalba
683595fee1 Silence a bunch of warnings under MSVC /W4
Still some remain, but are really the silly ones.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-31 20:49:56 +01:00
Marco Costalba
cc8e915ed5 Merge KBPP vs KB endgame from iPhone Glaurung
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-22 13:06:29 +01:00
Marco Costalba
67375f4693 Use template for endgame scaling functions
Also integrate scaling and evaluation in a
single base class.

Nice use of templates here :-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-13 20:55:29 +01:00
Marco Costalba
039badfda8 Use templates for end game evaluation functions
Huge simplification and no speed cost penalty.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-13 20:55:14 +01:00
Marco Costalba
82bf08e4f2 Final endgame.cpp space inflate
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-04 19:40:31 +01:00
Marco Costalba
ec2927286a Start to space inflate endgame.cpp
Still a lot to do, it's a big file!

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-01-08 15:46:57 +01:00
Marco Costalba
c97104e854 Big trailing whitespace cleanup part 1
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-01-07 15:47:59 +01:00
Marco Costalba
f178f0a291 Merged two new endgames from Glaurung 2.2
It is two bishop against a knight and two minor
pieces against one minor piece.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-21 15:38:10 +01:00
Marco Costalba
5dc2312121 Update copyright info
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:20 +02:00
Marco Costalba
760f77872f Remove Positions::xxx_count() functions
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:18 +02:00
Marco Costalba
d4f14a8e83 Remove Position::xxx_list() functions
No useful, only obfuscating.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:17 +02:00
Marco Costalba
d9e54ceaa1 Prefer template to name decoration
This also allows faster code although bigger.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:16 +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
bb751d6c89 Initial import of Glaurung 2.1 2008-09-01 07:59:13 +02:00