Go to the documentation of this file.00001
00004 #ifndef EVAL_ENDGAME_ATTACKKING_H
00005 #define EVAL_ENDGAME_ATTACKKING_H
00006
00007 #include "osl/eval/endgame/kingPieceTable.h"
00008 #include "osl/state/simpleState.h"
00009
00010 namespace osl
00011 {
00012 namespace eval
00013 {
00014 namespace endgame
00015 {
00019 class AttackKing
00020 {
00021 struct Table : public KingPieceTable
00022 {
00023 Table();
00024 private:
00025 void adhoc_edge_king_1(const Player player,
00026 const Square king,
00027 const Square attack);
00028 void adhoc_edge_king_2(const Player player,
00029 const Square king,
00030 const Square attack);
00031 };
00032 static Table table;
00033 public:
00034 static int valueOf(const Piece king, const Piece attacker)
00035 {
00036 return valueOf(king, attacker.ptypeO(), attacker.square());
00037 }
00038 static int valueOf(Piece king, PtypeO ptypeo, Square position)
00039 {
00040 assert(king.ptype() == KING);
00041 if (getOwner(ptypeo) == king.owner())
00042 return 0;
00043 return table.valueOf(king.square(), king.owner(),
00044 position, getPtype(ptypeo));
00045 }
00046 static void saveText(const char *filename);
00047 static void loadText(const char *filename) { table.loadText(filename); }
00048 static void resetWeights(const int *w) { table.resetWeights(w); }
00049 };
00050 }
00051 }
00052 }
00053
00054 #endif
00055
00056
00057
00058
00059