00001 /* passCounter.h 00002 */ 00003 #ifndef SEARCH_PASSCOUNTER_H 00004 #define SEARCH_PASSCOUNTER_H 00005 00006 namespace osl 00007 { 00008 namespace search 00009 { 00010 class PassCounter 00011 { 00012 CArray<int,2> counter; 00013 public: 00014 PassCounter() 00015 { 00016 counter.fill(0); 00017 } 00018 void inc(Player moving) 00019 { 00020 assert(playerToIndex(moving) >= 0); 00021 ++counter[playerToIndex(moving)]; 00022 } 00023 void dec(Player moving) 00024 { 00025 --counter[playerToIndex(moving)]; 00026 assert(playerToIndex(moving) >= 0); 00027 } 00028 bool loopByBothPass() const 00029 { 00030 return counter[0] && counter[1]; 00031 } 00032 }; 00033 } // namespace search 00034 } // namespace osl 00035 00036 #endif /* __H */ 00037 // ;;; Local Variables: 00038 // ;;; mode:c++ 00039 // ;;; c-basic-offset:2 00040 // ;;; End: