defenseKing.h
Go to the documentation of this file.
00001 
00004 #ifndef EVAL_ENDGAME_DEFENSEKING_H
00005 #define EVAL_ENDGAME_DEFENSEKING_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 DefenseKing
00020       {
00021         struct Table : public KingPieceTable
00022         {
00023           Table();
00024         };
00025         static Table table;
00026       public:
00027         static int valueOf(const Piece king, const Piece defender)
00028         {
00029           return valueOf(king, defender.ptypeO(), defender.square());
00030         }
00031         static int valueOf(Piece king, PtypeO ptypeo, Square position)
00032         {
00033           assert(king.ptype() == KING);
00034           if (getOwner(ptypeo) != king.owner())
00035             return 0;
00036           return table.valueOf(king.square(), king.owner(), 
00037                                position, getPtype(ptypeo));
00038         }
00039         static void saveText(const char *filename) { table.saveText(filename); }
00040         static void loadText(const char *filename) { table.loadText(filename); }
00041         static void resetWeights(const int *w) { table.resetWeights(w); }
00042       };
00043     } // namespace endgame
00044   } // namespace endgame
00045 } // namespace osl
00046 
00047 #endif /* EVAL_ENDGAME_DEFENSEKING_H */
00048 // ;;; Local Variables:
00049 // ;;; mode:c++
00050 // ;;; c-basic-offset:2
00051 // ;;; coding:utf-8
00052 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines