checkmateGroup.h
Go to the documentation of this file.
00001 /* checkmateGroup.h
00002  */
00003 #ifndef _CHECKMATEGROUP_H
00004 #define _CHECKMATEGROUP_H
00005 
00006 #include "osl/rating/group.h"
00007 #include "osl/rating/feature/checkmate.h"
00008 
00009 namespace osl
00010 {
00011   namespace rating
00012   {
00013     class CheckmateIfCaptureGroup : public Group
00014     {
00015     public:
00016       CheckmateIfCaptureGroup() : Group("CheckmateCap")
00017       {
00018         for (int p=0; p<8; ++p) // progress8
00019           push_back(new CheckmateIfCapture);
00020       }
00021       void show(std::ostream& os, int name_width, const range_t& range, 
00022                 const vector<double>& weights) const
00023       {
00024         showAll(os, name_width, range, weights);
00025       }
00026       int findMatch(const NumEffectState& state, Move move, const RatingEnv& env) const
00027       {
00028         const int progress8 = env.progress.value()/2;
00029         if ((*this)[0].match(state, move, env))
00030           return progress8;
00031         return -1;
00032       }
00033     };
00034     struct ThreatmateGroup : public Group
00035     {
00036       ThreatmateGroup() : Group("Threatmate")
00037       {
00038         for (int p=0; p<8; ++p) // progress8
00039           push_back(new Threatmate);
00040       }
00041       void show(std::ostream& os, int name_width, const range_t& range, 
00042                 const vector<double>& weights) const
00043       {
00044         showAll(os, name_width, range, weights);
00045       }
00046       int findMatch(const NumEffectState& state, Move move, const RatingEnv& env) const
00047       {
00048         const int progress8 = env.progress.value()/2;
00049         if ((*this)[0].match(state, move, env))
00050           return progress8;
00051         return -1;
00052       }
00053     };
00054   }
00055 } // name_width osl
00056 
00057 #endif /* _CHECKMATEGROUP_H */
00058 // ;;; Local Variables:
00059 // ;;; mode:c++
00060 // ;;; c-basic-offset:2
00061 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines