patternGroup.h
Go to the documentation of this file.
00001 /* patternGroup.h
00002  */
00003 #ifndef _PATTERNGROUP_H
00004 #define _PATTERNGROUP_H
00005 
00006 #include "osl/rating/group.h"
00007 #include "osl/rating/feature/pattern.h"
00008 
00009 namespace osl
00010 {
00011   namespace rating
00012   {
00013     struct PatternGroup : public Group
00014     {
00015       static std::string name(Direction direction, Direction direction2);
00016       Direction direction, direction2;
00017       CArray2d<unsigned char, 2, Square::SIZE> target_table;
00018       explicit PatternGroup(Direction d, Direction d2 = Pattern::INVALID);
00019       void show(std::ostream& os, int name_width, const range_t& range, 
00020                 const vector<double>& weights) const
00021       {
00022         showTopN(os, name_width, range, weights, 3);
00023       }
00024       int findMatch(const NumEffectState& state, Move m, const RatingEnv&) const;
00025       bool effectiveInCheck() const { return true; }
00026     };
00027 
00028 
00029     class PatternLongGroup : public Group
00030     {
00031     public:
00032       static const CArray<Direction,4> rook_direction4;
00033       static const CArray<Direction,4> bishop_direction4;
00034     private:
00035       static std::string name(int direction_id);
00036       int direction_id;
00037     public:
00038       explicit PatternLongGroup(int d);
00039 
00040       Direction makeDirection(Ptype ptype) const 
00041       {
00042         return (unpromote(ptype) == BISHOP) ? bishop_direction4[direction_id] : rook_direction4[direction_id];
00043       }
00044       void show(std::ostream& os, int name_width, const range_t& range, 
00045                 const vector<double>& weights) const
00046       {
00047         showTopN(os, name_width, range, weights, 3);
00048       }
00049       int findMatch(const NumEffectState& state, Move m, const RatingEnv& env) const;
00050       bool effectiveInCheck() const { return true; }
00051     };
00052 
00053 
00054     class PatternLongGroup2 : public Group
00055     {
00056       static std::string name(int direction_id);
00057       int direction_id;
00058     public:
00059       PatternLongGroup2(int d);
00060 
00061       Direction makeDirection(Ptype ptype) const 
00062       {
00063         return (unpromote(ptype) == BISHOP) 
00064           ? PatternLongGroup::bishop_direction4[direction_id] 
00065           : PatternLongGroup::rook_direction4[direction_id];
00066       }
00067       void show(std::ostream& os, int name_width, const range_t& range, 
00068                 const vector<double>& weights) const
00069       {
00070         showTopN(os, name_width, range, weights, 3);
00071       }
00072       int findMatch(const NumEffectState& state, Move m, const RatingEnv& env) const;
00073       bool effectiveInCheck() const { return true; }
00074     };
00075 
00076     class PatternBlockGroup : public Group
00077     {
00078       Ptype attacker;
00079     public:
00080       explicit PatternBlockGroup(Ptype attacker);
00081       void show(std::ostream& os, int name_width, const range_t& range, 
00082                 const vector<double>& weights) const
00083       {
00084         showTopN(os, name_width, range, weights, 3);
00085       }
00086       int findMatch(const NumEffectState& state, Move m, const RatingEnv& env) const;
00087     };
00088   }
00089 }
00090 
00091 #endif /* _PATTERNGROUP_H */
00092 // ;;; Local Variables:
00093 // ;;; mode:c++
00094 // ;;; c-basic-offset:2
00095 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines