squareGroup.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
squareGroup.h
Go to the documentation of this file.
1 /* squareGroup.h
2 */
3 #ifndef _POSITIONGROUP_H
4 #define _POSITIONGROUP_H
5
6 #include "osl/rating/group.h"
7 #include "osl/rating/feature/square.h"
8
9 namespace osl
10 {
11 namespace rating
12 {
13 struct RelativeKingXGroup : public Group
14 {
15 bool attack;
16 RelativeKingXGroup(bool a);
17 void show(std::ostream& os, int name_width, const range_t& range,
18 const vector<double>& weights) const
19 {
20 showTopN(os, name_width, range, weights, 3);
21 }
22 int findMatch(const NumEffectState& state, Move move, const RatingEnv& env) const
23 {
24 const int progress8 = env.progress.value()/2;
25 const int index = RelativeKingX::index(attack, state, move);
26 return index*8 + progress8;
27 }
28 bool effectiveInCheck() const { return true; }
29 };
30
31 struct RelativeKingYGroup : public Group
32 {
33 bool attack;
34 RelativeKingYGroup(bool a);
35 void show(std::ostream& os, int name_width, const range_t& range,
36 const vector<double>& weights) const
37 {
38 showTopN(os, name_width, range, weights, 3);
39 }
40 int findMatch(const NumEffectState& state, Move move, const RatingEnv& env) const
41 {
42 const int progress8 = env.progress.value()/2;
43 const int index = RelativeKingY::index(attack, state, move);
44 return index*8+progress8;
45 }
46 bool effectiveInCheck() const { return true; }
47 };
48
49 struct SquareXGroup : public Group
50 {
51 SquareXGroup();
52 void show(std::ostream& os, int name_width, const range_t& range,
53 const vector<double>& weights) const
54 {
55 showTopN(os, name_width, range, weights, 3);
56 }
57 int findMatch(const NumEffectState& , Move move, const RatingEnv& env) const
58 {
59 const int progress8 = env.progress.value()/2;
60 int index = DropPtype::UNIT*(SquareX::makeX(move)-1);
61 index += DropPtype::index(move);
62 return index*8+progress8;
63 }
64 bool effectiveInCheck() const { return true; }
65 };
66
67 struct SquareYGroup : public Group
68 {
69 SquareYGroup();
70 void show(std::ostream& os, int name_width, const range_t& range,
71 const vector<double>& weights) const
72 {
73 showTopN(os, name_width, range, weights, 3);
74 }
75 int findMatch(const NumEffectState&, Move move, const RatingEnv& env) const
76 {
77 const int progress8 = env.progress.value()/2;
78 int index = DropPtype::UNIT*(SquareY::makeY(move)-1);
79 index += DropPtype::index(move);
80 return index*8+progress8;
81 }
82 bool effectiveInCheck() const { return true; }
83 };
84 }
85 }
86
87
88 #endif /* _POSITIONGROUP_H */
89 // ;;; Local Variables:
90 // ;;; mode:c++
91 // ;;; c-basic-offset:2
92 // ;;; End: