00001 /* ptypePosition.h 00002 */ 00003 #ifndef _PTYPEPOSITION_H 00004 #define _PTYPEPOSITION_H 00005 00006 #include "osl/category/categoryEnv.h" 00007 #include "osl/category/categoryTraits.h" 00008 #include "osl/misc/carray.h" 00009 00010 namespace osl 00011 { 00012 namespace category 00013 { 00014 struct PtypePositionTable : public ProbTable<32*256*256> 00015 { 00016 typedef ProbTable<32*256*256> base_t; 00017 PtypePositionTable(const char *h, const char *n) 00018 : base_t(h,n) 00019 { 00020 } 00021 static int getIndex(Move move) 00022 { 00023 PtypeO ptypeO=move.ptypeO(); 00024 Position from=move.from(); 00025 Position to=move.to(); 00026 size_t index=(ptypeO-PTYPEO_MIN)*256*256+from.index()*256+to.index(); 00027 return index; 00028 } 00029 }; 00030 00034 struct PtypePosition : public TableProbabilityCategory 00035 { 00036 static Interpolator<PtypePositionTable> probTable; 00037 static const char *getName() { return "PtypePosition"; } 00038 static const bool FirstMatchOnly = true; 00039 static size_t getIndex(const CategoryEnv&, Move m) 00040 { 00041 return PtypePositionTable::getIndex(m); 00042 } 00043 static std::pair<bool,size_t> 00044 getIndexIf(const CategoryEnv& e, Move m, int /*piece_value*/) 00045 { 00046 return std::make_pair(true, getIndex(e,m)); 00047 } 00048 static bool isInCategory(const CategoryEnv&, Move) 00049 { 00050 return true; 00051 } 00052 }; 00053 } // namespace category 00054 } // namespace osl 00055 00056 #endif /* _PTYPEPOSITION_H */ 00057 // ;;; Local Variables: 00058 // ;;; mode:c++ 00059 // ;;; c-basic-offset:2 00060 // ;;; End: