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