00001 //---------------------------------------------------------------------------- 00002 /** @file SgStrategy.cpp 00003 See SgStrategy.h 00004 */ 00005 //---------------------------------------------------------------------------- 00006 00007 #include "SgSystem.h" 00008 #include "SgStrategy.h" 00009 00010 #include <iostream> 00011 #include "SgWrite.h" 00012 00013 //---------------------------------------------------------------------------- 00014 00015 std::ostream& operator<<(std::ostream& stream, SgStrategyStatus f) 00016 { 00017 static const char* s_string[_SGSTRATEGY_COUNT] = 00018 { 00019 "SGSTRATEGY_ACHIEVED", 00020 "SGSTRATEGY_THREATENED", 00021 "SGSTRATEGY_UNKNOWN", 00022 "SGSTRATEGY_FAILED" 00023 }; 00024 00025 stream << s_string[f]; 00026 return stream; 00027 } 00028 00029 //---------------------------------------------------------------------------- 00030 00031 SgStrategy::SgStrategy(SgBlackWhite player) 00032 : m_player(player) 00033 { } 00034 00035 std::ostream& operator<<(std::ostream& stream, const SgStrategy& s) 00036 { 00037 s.Write(stream); 00038 return stream; 00039 } 00040 00041 void SgStrategy::Write(std::ostream& stream) const 00042 { 00043 stream << "Player " << SgBW(m_player) 00044 << ", Status " << Status() 00045 << '\n'; 00046 } 00047 00048 void SgStrategy::Clear() 00049 { 00050 m_code.Clear(); 00051 }