passCounter.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
passCounter.h
Go to the documentation of this file.
1 /* passCounter.h
2 */
3 #ifndef SEARCH_PASSCOUNTER_H
4 #define SEARCH_PASSCOUNTER_H
5
6 namespace osl
7 {
8 namespace search
9 {
10 class PassCounter
11 {
12 CArray<int,2> counter;
13 public:
14 PassCounter()
15 {
16 counter.fill(0);
17 }
18 void inc(Player moving)
19 {
20 assert(playerToIndex(moving) >= 0);
21 ++counter[moving];
22 }
23 void dec(Player moving)
24 {
25 --counter[moving];
26 assert(playerToIndex(moving) >= 0);
27 }
28 bool loopByBothPass() const
29 {
30 return counter[0] && counter[1];
31 }
32 };
33 } // namespace search
34 } // namespace osl
35
36 #endif /* __H */
37 // ;;; Local Variables:
38 // ;;; mode:c++
39 // ;;; c-basic-offset:2
40 // ;;; End: