説明を見る。00001
00002
00003 #ifndef _CAPTURE_H
00004 #define _CAPTURE_H
00005
00006 #include "osl/rating/feature.h"
00007 #include "osl/eval/see.h"
00008 #include "osl/effect_util/shadowEffect.h"
00009 #include "osl/additionalEffect.h"
00010
00011 namespace osl
00012 {
00013 namespace rating
00014 {
00015 class Capture : public Feature
00016 {
00017 public:
00018 enum { INF = 999999 };
00019 private:
00020 int first, last;
00021 static const std::string name(int first, int last);
00022 public:
00023 Capture(int f, int l) : Feature(name(f, l)), first(f), last(l) {}
00024 static int see(const NumEffectState& state, Move move, const RatingEnv& env)
00025 {
00026 int see = See::see(state, move, env.my_pin, env.op_pin);
00027 see = see*100/128;
00028 return see;
00029 }
00030 bool match(const NumEffectState& state, Move move, const RatingEnv& env) const
00031 {
00032 int see = this->see(state, move, env);
00033 return first <= see && see < last;
00034 }
00035 };
00036
00037 class ShadowEffect1 : public Feature
00038 {
00039 public:
00040 ShadowEffect1() : Feature("ShadowEffect1") {}
00041 bool match(const NumEffectState& state, Move move, const RatingEnv&) const
00042 {
00043 return ShadowEffect::count2(state, move.to(), move.player()) == 1;
00044 }
00045 };
00046
00047 class ShadowEffect2 : public Feature
00048 {
00049 public:
00050 ShadowEffect2() : Feature("ShadowEffect2") {}
00051 bool match(const NumEffectState& state, Move move, const RatingEnv&) const
00052 {
00053 return ShadowEffect::count2(state, move.to(), move.player()) == 2;
00054 }
00055 };
00056
00057 class ContinueCapture : public Feature
00058 {
00059 public:
00060 ContinueCapture() : Feature("Cont.C") {}
00061 bool match(const NumEffectState&, Move move, const RatingEnv& env) const
00062 {
00063 return env.history.hasLastMove(2) && env.history.lastMove(2).to() == move.from()
00064 && move.capturePtype() != PTYPE_EMPTY;
00065 }
00066 };
00067
00069 class DropCaptured : public Feature
00070 {
00071 Ptype ptype;
00072 public:
00073 DropCaptured(Ptype ptype);
00074 bool match(const NumEffectState&, Move move, const RatingEnv& env) const
00075 {
00076 return move.isDrop() && move.ptype() == ptype
00077 && env.history.hasLastMove(2) && env.history.lastMove(2).isNormal()
00078 && env.history.lastMove(2).capturePtype() != PTYPE_EMPTY
00079 && unpromote(env.history.lastMove(2).capturePtype()) == ptype;
00080 }
00081 };
00082
00083 }
00084 }
00085
00086
00087 #endif
00088
00089
00090
00091