00001
00002
00003 #ifndef _PTYPEPTYPEPROBTABLE_H
00004 #define _PTYPEPTYPEPROBTABLE_H
00005
00006 #include "osl/category/probTable.h"
00007 #include "osl/ptype.h"
00008 namespace osl
00009 {
00010 namespace category
00011 {
00012 class PtypePtypeProbTable : public ProbTable<2*16*16*PieceValueTableLength>
00013 {
00014 typedef ProbTable<2*16*16*PieceValueTableLength> base_t;
00015 public:
00016 PtypePtypeProbTable(const char *h, const char *n);
00017 ~PtypePtypeProbTable();
00018
00019 static size_t getIndex(Ptype targetPtype,
00020 bool targetHasSupport,
00021 Ptype attackerPtype,
00022 int pieceValue)
00023 {
00024 const size_t support = targetHasSupport*16*16*PieceValueTableLength;
00025 const size_t ptypeIndex = static_cast<int>(targetPtype)*16
00026 + static_cast<int>(attackerPtype);
00027
00028 return ptypeIndex*PieceValueTable::indexMax()
00029 + PieceValueTable::getIndex(pieceValue) + support;
00030 }
00031 void interpolate();
00032 void show();
00033 };
00037 class PtypePtype2ProbTable : public ProbTable<2*16*2*16*16*PieceValueTableLength>
00038 {
00039 typedef ProbTable<2*16*2*16*16*PieceValueTableLength> base_t;
00040 public:
00041 PtypePtype2ProbTable(const char *h, const char *n);
00042 ~PtypePtype2ProbTable();
00043 static size_t getIndex(Ptype targetPtype0,
00044 Ptype targetPtype1,
00045 const CArray<bool,2>& targetHasSupport,
00046 Ptype attackerPtype,
00047 int pieceValue)
00048 {
00049
00050 return ((((targetHasSupport[0] * 16 + targetPtype0)*2*16
00051 + (targetHasSupport[1] * 16 + targetPtype1))
00052 * 16 + attackerPtype)
00053 *PieceValueTable::indexMax()
00054 + PieceValueTable::getIndex(pieceValue));
00055 }
00056 void interpolate();
00057 };
00058
00062 struct PtypeValueTable : public ProbTable<PieceValueTableLength*16*2>
00063 {
00064 typedef ProbTable<PieceValueTableLength*16*2> base_t;
00065 PtypeValueTable(const char *h, const char *n);
00066 ~PtypeValueTable();
00067
00068 static size_t getIndex(bool hasSupport,
00069 Ptype attackerPtype,
00070 int pieceValue)
00071 {
00072 const size_t support = hasSupport*PieceValueTableLength*16;
00073 const size_t ptypeIndex = static_cast<int>(attackerPtype);
00074 return ptypeIndex*PieceValueTableLength
00075 + PieceValueTable::getIndex(pieceValue) + support;
00076 }
00077 void interpolate();
00078 };
00079 }
00080 }
00081
00082 #endif
00083
00084
00085
00086