patternGroup.h
Go to the documentation of this file.
/* patternGroup.h
*/
#ifndef _PATTERNGROUP_H
#define _PATTERNGROUP_H
#include "osl/rating/group.h"
#include "osl/rating/feature/pattern.h"
namespace osl
{
namespace rating
{
struct PatternGroup : public Group
{
static std::string name(Direction direction, Direction direction2);
Direction direction, direction2;
CArray2d<unsigned char, 2, Square::SIZE> target_table;
explicit PatternGroup(Direction d, Direction d2 = Pattern::INVALID);
void show(std::ostream& os, int name_width, const range_t& range,
const std::vector<double>& weights) const
{
showTopN(os, name_width, range, weights, 3);
}
int findMatch(const NumEffectState& state, Move m, const RatingEnv&) const;
bool effectiveInCheck() const { return true; }
};
class PatternLongGroup : public Group
{
public:
static const CArray<Direction,4> rook_direction4;
static const CArray<Direction,4> bishop_direction4;
private:
static std::string name(int direction_id);
int direction_id;
public:
explicit PatternLongGroup(int d);
Direction makeDirection(Ptype ptype) const
{
return (unpromote(ptype) == BISHOP) ? bishop_direction4[direction_id] : rook_direction4[direction_id];
}
void show(std::ostream& os, int name_width, const range_t& range,
const std::vector<double>& weights) const
{
showTopN(os, name_width, range, weights, 3);
}
int findMatch(const NumEffectState& state, Move m, const RatingEnv& env) const;
bool effectiveInCheck() const { return true; }
};
class PatternLongGroup2 : public Group
{
static std::string name(int direction_id);
int direction_id;
public:
PatternLongGroup2(int d);
Direction makeDirection(Ptype ptype) const
{
return (unpromote(ptype) == BISHOP)
? PatternLongGroup::bishop_direction4[direction_id]
: PatternLongGroup::rook_direction4[direction_id];
}
void show(std::ostream& os, int name_width, const range_t& range,
const std::vector<double>& weights) const
{
showTopN(os, name_width, range, weights, 3);
}
int findMatch(const NumEffectState& state, Move m, const RatingEnv& env) const;
bool effectiveInCheck() const { return true; }
};
class PatternBlockGroup : public Group
{
Ptype attacker;
public:
explicit PatternBlockGroup(Ptype attacker);
void show(std::ostream& os, int name_width, const range_t& range,
const std::vector<double>& weights) const
{
showTopN(os, name_width, range, weights, 3);
}
int findMatch(const NumEffectState& state, Move m, const RatingEnv& env) const;
};
}
}
#endif /* _PATTERNGROUP_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
osl::CArray
Definition container.h:20
osl::Move
圧縮していない moveの表現 .
Definition basic_type.h:1052
osl::NumEffectState
利きを持つ局面
Definition numEffectState.h:34
osl::rating::Group::showTopN
void showTopN(std::ostream &os, int name_width, const range_t &range, const std::vector< double > &weights, int n) const
Definition group.cc:100
osl::rating::Group::Group
Group(const std::string &name)
Definition group.cc:15
osl::rating::PatternBlockGroup::attacker
Ptype attacker
Definition patternGroup.h:78
osl::rating::PatternBlockGroup::PatternBlockGroup
PatternBlockGroup(Ptype attacker)
Definition patternGroup.cc:199
osl::rating::PatternBlockGroup::findMatch
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
Definition patternGroup.cc:221
osl::rating::PatternBlockGroup::show
void show(std::ostream &os, int name_width, const range_t &range, const std::vector< double > &weights) const
Definition patternGroup.h:81
osl::rating::PatternLongGroup2::effectiveInCheck
bool effectiveInCheck() const
Definition patternGroup.h:73
osl::rating::PatternLongGroup2::PatternLongGroup2
PatternLongGroup2(int d)
Definition patternGroup.cc:148
osl::rating::PatternLongGroup2::name
static std::string name(int direction_id)
Definition patternGroup.cc:141
osl::rating::PatternLongGroup2::findMatch
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
Definition patternGroup.cc:163
osl::rating::PatternLongGroup2::direction_id
int direction_id
Definition patternGroup.h:57
osl::rating::PatternLongGroup2::show
void show(std::ostream &os, int name_width, const range_t &range, const std::vector< double > &weights) const
Definition patternGroup.h:67
osl::rating::PatternLongGroup2::makeDirection
Direction makeDirection(Ptype ptype) const
Definition patternGroup.h:61
osl::rating::PatternLongGroup::show
void show(std::ostream &os, int name_width, const range_t &range, const std::vector< double > &weights) const
Definition patternGroup.h:44
osl::rating::PatternLongGroup::effectiveInCheck
bool effectiveInCheck() const
Definition patternGroup.h:50
osl::rating::PatternLongGroup::findMatch
int findMatch(const NumEffectState &state, Move m, const RatingEnv &env) const
Definition patternGroup.cc:98
osl::rating::PatternLongGroup::PatternLongGroup
PatternLongGroup(int d)
Definition patternGroup.cc:75
osl::rating::PatternLongGroup::makeDirection
Direction makeDirection(Ptype ptype) const
Definition patternGroup.h:40
osl::rating::PatternLongGroup::bishop_direction4
static const CArray< Direction, 4 > bishop_direction4
Definition patternGroup.h:66
osl::rating::PatternLongGroup::direction_id
int direction_id
Definition patternGroup.h:36
osl::rating::PatternLongGroup::rook_direction4
static const CArray< Direction, 4 > rook_direction4
Definition patternGroup.h:65
osl::rating::PatternLongGroup::name
static std::string name(int direction_id)
Definition patternGroup.cc:68
osl::rating::Pattern::INVALID
static const Direction INVALID
Definition pattern.h:16
osl::rating::RatingEnv
Definition ratingEnv.h:16
group.h
osl::rating
Definition construct.h:18
osl::rating::range_t
std::pair< int, int > range_t
Definition range.h:10
osl
Definition additionalEffect.h:6
osl::Ptype
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
osl::BISHOP
@ BISHOP
Definition basic_type.h:99
osl::CArray2d
CArray< CArray< T, Capacity2 >, Capacity1 > CArray2d
Definition container.h:95
osl::unpromote
Ptype unpromote(Ptype ptype)
ptypeがpromote後の型の時に，promote前の型を返す． promoteしていない型の時はそのまま返す
Definition basic_type.h:157
osl::Direction
Direction
Definition basic_type.h:310
pattern.h
osl::rating::PatternGroup::direction2
Direction direction2
Definition patternGroup.h:16
osl::rating::PatternGroup::target_table
CArray2d< unsigned char, 2, Square::SIZE > target_table
Definition patternGroup.h:17
osl::rating::PatternGroup::findMatch
int findMatch(const NumEffectState &state, Move m, const RatingEnv &) const
Definition patternGroup.cc:33
osl::rating::PatternGroup::direction
Direction direction
Definition patternGroup.h:16
osl::rating::PatternGroup::show
void show(std::ostream &os, int name_width, const range_t &range, const std::vector< double > &weights) const
Definition patternGroup.h:19
osl::rating::PatternGroup::effectiveInCheck
bool effectiveInCheck() const
Definition patternGroup.h:25
osl::rating::PatternGroup::PatternGroup
PatternGroup(Direction d, Direction d2=Pattern::INVALID)
Definition patternGroup.cc:6
osl::rating::PatternGroup::name
static std::string name(Direction direction, Direction direction2)
Definition patternGroup.cc:56