00001 //---------------------------------------------------------------------------- 00002 /** @file GoPlayer.cpp 00003 See GoPlayer.h */ 00004 //---------------------------------------------------------------------------- 00005 00006 #include "SgSystem.h" 00007 #include "GoPlayer.h" 00008 00009 #include <limits> 00010 #include "GoBoard.h" 00011 #include "SgNode.h" 00012 00013 using namespace std; 00014 00015 //---------------------------------------------------------------------------- 00016 00017 GoPlayer::GoPlayer(const GoBoard& bd) 00018 : GoBoardSynchronizer(bd), 00019 m_currentNode(0), 00020 m_bd(bd.Size(), GoSetup(), bd.Rules()), 00021 m_variant(0) 00022 { 00023 SetSubscriber(m_bd); 00024 ClearSearchTraces(); 00025 } 00026 00027 GoPlayer::~GoPlayer() 00028 { 00029 if (m_currentNode != 0) 00030 m_currentNode->DeleteTree(); 00031 } 00032 00033 void GoPlayer::ClearSearchTraces() 00034 { 00035 if (m_currentNode != 0) 00036 m_currentNode->DeleteTree(); 00037 m_currentNode = new SgNode(); 00038 m_currentNode->AddComment("Search traces"); 00039 } 00040 00041 int GoPlayer::MoveValue(SgPoint p) 00042 { 00043 SG_UNUSED(p); 00044 return numeric_limits<int>::min(); 00045 } 00046 00047 std::string GoPlayer::Name() const 00048 { 00049 return "Unknown"; 00050 } 00051 00052 void GoPlayer::OnGameFinished() 00053 { 00054 } 00055 00056 void GoPlayer::OnNewGame() 00057 { 00058 } 00059 00060 void GoPlayer::Ponder() 00061 { 00062 } 00063 00064 SgNode* GoPlayer::TransferSearchTraces() 00065 { 00066 SgNode* node = m_currentNode; 00067 if (node->NumSons() == 0) 00068 return 0; 00069 m_currentNode = 0; 00070 ClearSearchTraces(); 00071 return node; 00072 } 00073 00074 //---------------------------------------------------------------------------- 00075