00001
00002
00003 #ifndef _POSITIONGROUP_H
00004 #define _POSITIONGROUP_H
00005
00006 #include "osl/rating/group.h"
00007 #include "osl/rating/feature/position.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 PositionXGroup : public Group
00050 {
00051 PositionXGroup();
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& state, Move move, const RatingEnv& env) const
00058 {
00059 const int progress8 = env.progress.value()/2;
00060 int index = DropPtype::UNIT*(PositionX::makeX(move)-1);
00061 index += DropPtype::index(move);
00062 return index*8+progress8;
00063 }
00064 bool effectiveInCheck() const { return true; }
00065 };
00066
00067 struct PositionYGroup : public Group
00068 {
00069 PositionYGroup();
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& state, Move move, const RatingEnv& env) const
00076 {
00077 const int progress8 = env.progress.value()/2;
00078 int index = DropPtype::UNIT*(PositionY::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
00089
00090
00091
00092