squareGroup.h
Go to the documentation of this file.
00001 /* squareGroup.h
00002  */
00003 #ifndef _POSITIONGROUP_H
00004 #define _POSITIONGROUP_H
00005 
00006 #include "osl/rating/group.h"
00007 #include "osl/rating/feature/square.h"
00008 
00009 namespace osl
00010 {
00011   namespace rating
00012   {
00013     struct RelativeKingXGroup : public Group
00014     {
00015       bool attack;
00016       RelativeKingXGroup(bool a);
00017       void show(std::ostream& os, int name_width, const range_t& range, 
00018                 const vector<double>& weights) const
00019       {
00020         showTopN(os, name_width, range, weights, 3);
00021       }
00022       int findMatch(const NumEffectState& state, Move move, const RatingEnv& env) const
00023       {
00024         const int progress8 = env.progress.value()/2;
00025         const int index = RelativeKingX::index(attack, state, move);
00026         return index*8 + progress8;
00027       }  
00028       bool effectiveInCheck() const { return true; }
00029     };
00030 
00031     struct RelativeKingYGroup : public Group
00032     {
00033       bool attack;
00034       RelativeKingYGroup(bool a);
00035       void show(std::ostream& os, int name_width, const range_t& range, 
00036                 const vector<double>& weights) const
00037       {
00038         showTopN(os, name_width, range, weights, 3);
00039       }
00040       int findMatch(const NumEffectState& state, Move move, const RatingEnv& env) const
00041       {
00042         const int progress8 = env.progress.value()/2;
00043         const int index = RelativeKingY::index(attack, state, move);
00044         return index*8+progress8;
00045       }  
00046       bool effectiveInCheck() const { return true; }
00047     };
00048 
00049     struct SquareXGroup : public Group
00050     {
00051       SquareXGroup();
00052       void show(std::ostream& os, int name_width, const range_t& range, 
00053                 const vector<double>& weights) const
00054       {
00055         showTopN(os, name_width, range, weights, 3);
00056       }
00057       int findMatch(const NumEffectState& , Move move, const RatingEnv& env) const
00058       {
00059         const int progress8 = env.progress.value()/2;
00060         int index = DropPtype::UNIT*(SquareX::makeX(move)-1);
00061         index += DropPtype::index(move);
00062         return index*8+progress8;
00063       }
00064       bool effectiveInCheck() const { return true; }
00065     };
00066 
00067     struct SquareYGroup : public Group
00068     {
00069       SquareYGroup();
00070       void show(std::ostream& os, int name_width, const range_t& range, 
00071                 const vector<double>& weights) const
00072       {
00073         showTopN(os, name_width, range, weights, 3);
00074       }
00075       int findMatch(const NumEffectState&, Move move, const RatingEnv& env) const
00076       {
00077         const int progress8 = env.progress.value()/2;
00078         int index = DropPtype::UNIT*(SquareY::makeY(move)-1);
00079         index += DropPtype::index(move);
00080         return index*8+progress8;
00081       }
00082       bool effectiveInCheck() const { return true; }
00083     };
00084   }
00085 }
00086 
00087 
00088 #endif /* _POSITIONGROUP_H */
00089 // ;;; Local Variables:
00090 // ;;; mode:c++
00091 // ;;; c-basic-offset:2
00092 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines