]> git.sesse.net Git - stockfish/commit
Simplify endgame functions handling
authorMarco Costalba <mcostalba@gmail.com>
Thu, 16 Jul 2009 12:31:32 +0000 (14:31 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 17 Jul 2009 06:55:51 +0000 (07:55 +0100)
commit297c12e595ebc33e11be73ee4b188326418acb4f
tree1596492b123d06360817c3894518143c688e23b3
parent5c20f59788c30cdfc5b1d16dae125ab394c5145c
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>
src/endgame.cpp
src/endgame.h
src/material.cpp