Traces a search. More...
#include <SgSearchTracer.h>
Public Member Functions | |
SgSearchTracer (SgNode *root) | |
virtual | ~SgSearchTracer () |
void | AddTraceNode (SgMove move, SgBlackWhite player) |
Adds the given move as a new node to the trace tree and goes to that node. | |
SgNode * | TraceNode () const |
Current node. | |
void | TraceComment (const char *comment) const |
Add comment to current tracenode. | |
void | StartOfDepth (int depth) |
virtual void | AddMoveProp (SgNode *node, SgMove move, SgBlackWhite player) |
Adds move property to node (game-dependent). | |
void | TraceValue (int value, SgBlackWhite toPlay) const |
Add value as a comment to current tracenode. | |
void | TraceValue (int value, SgBlackWhite toPlay, const char *comment, bool isExact) const |
Add value and text as a comment to current tracenode. | |
void | TakeBackTraceNode () |
Go one move up in the trace tree. | |
virtual bool | TraceIsOn () const |
Is tracing on? Default implementation always returns true. | |
virtual void | InitTracing (const std::string &type) |
Creates a new root node for tracing. | |
void | AppendTrace (SgNode *toNode) |
Move trace tree to a subtree of toNode, and set m_traceNode = 0. | |
Protected Attributes | |
SgNode * | m_traceNode |
Current node in tracing. | |
Private Member Functions | |
SgSearchTracer (const SgSearchTracer &) | |
Not implemented. | |
SgSearchTracer & | operator= (const SgSearchTracer &) |
Not implemented. |
Traces a search.
Definition at line 18 of file SgSearchTracer.h.
SgSearchTracer::SgSearchTracer | ( | SgNode * | root | ) |
Definition at line 27 of file SgSearchTracer.cpp.
SgSearchTracer::~SgSearchTracer | ( | ) | [virtual] |
Definition at line 32 of file SgSearchTracer.cpp.
SgSearchTracer::SgSearchTracer | ( | const SgSearchTracer & | ) | [private] |
Not implemented.
void SgSearchTracer::AddMoveProp | ( | SgNode * | node, | |
SgMove | move, | |||
SgBlackWhite | player | |||
) | [virtual] |
Adds move property to node (game-dependent).
The default implementation stores the move in a SgMoveProp. Override this method for other games.
Definition at line 36 of file SgSearchTracer.cpp.
References SgNode::AddMoveProp().
Referenced by AddTraceNode().
void SgSearchTracer::AddTraceNode | ( | SgMove | move, | |
SgBlackWhite | player | |||
) |
Adds the given move as a new node to the trace tree and goes to that node.
Doesn't do anything if m_traceNode is 0.
Definition at line 42 of file SgSearchTracer.cpp.
References AddMoveProp(), m_traceNode, and SgNode::NewRightMostSon().
Referenced by SgSearch::CallExecute().
void SgSearchTracer::AppendTrace | ( | SgNode * | toNode | ) |
Move trace tree to a subtree of toNode, and set m_traceNode = 0.
Definition at line 51 of file SgSearchTracer.cpp.
References SgNode::AppendTo(), m_traceNode, and SgNode::Root().
Referenced by SgSearch::DepthFirstSearch(), and SgSearch::IteratedSearch().
void SgSearchTracer::InitTracing | ( | const std::string & | type | ) | [virtual] |
Creates a new root node for tracing.
Override to add information
Definition at line 60 of file SgSearchTracer.cpp.
References SgNode::Add(), m_traceNode, SG_ASSERT, and SG_PROP_COMMENT.
Referenced by SgSearch::DepthFirstSearch(), and SgSearch::IteratedSearch().
SgSearchTracer& SgSearchTracer::operator= | ( | const SgSearchTracer & | ) | [private] |
Not implemented.
void SgSearchTracer::StartOfDepth | ( | int | depth | ) |
Definition at line 67 of file SgSearchTracer.cpp.
References SgNode::AddComment(), SgNode::Father(), SgNode::HasFather(), m_traceNode, SgNode::NewRightMostSon(), SgNode::SetIntProp(), SG_ASSERT, and SG_PROP_MAX_DEPTH.
Referenced by SgSearch::StartOfDepth().
void SgSearchTracer::TakeBackTraceNode | ( | ) |
Go one move up in the trace tree.
Don't do anything if m_traceNode is null. To be called from the client's TakeBack method.
Definition at line 91 of file SgSearchTracer.cpp.
References SgNode::Father(), and m_traceNode.
Referenced by SgSearch::CallTakeBack().
void SgSearchTracer::TraceComment | ( | const char * | comment | ) | const |
Add comment to current tracenode.
Definition at line 97 of file SgSearchTracer.cpp.
References SgNode::AddComment(), and m_traceNode.
Referenced by SgSearch::AbortSearch(), SgSearch::NullMovePrune(), SgSearch::SearchEngine(), TraceValue(), and SgSearch::TryMove().
bool SgSearchTracer::TraceIsOn | ( | ) | const [virtual] |
Is tracing on? Default implementation always returns true.
Definition at line 81 of file SgSearchTracer.h.
Referenced by SgSearch::DepthFirstSearch(), SgSearch::IteratedSearch(), and SgSearch::TraceIsOn().
SgNode * SgSearchTracer::TraceNode | ( | ) | const |
Current node.
Definition at line 76 of file SgSearchTracer.h.
References m_traceNode.
Referenced by SgSearch::DepthFirstSearch(), and SgSearch::IteratedSearch().
void SgSearchTracer::TraceValue | ( | int | value, | |
SgBlackWhite | toPlay | |||
) | const |
Add value as a comment to current tracenode.
Definition at line 106 of file SgSearchTracer.cpp.
References SgNode::Add(), m_traceNode, SG_ASSERT, SG_PROP_VALUE, and SG_WHITE.
Referenced by SgSearch::SearchEngine(), and TraceValue().
void SgSearchTracer::TraceValue | ( | int | value, | |
SgBlackWhite | toPlay, | |||
const char * | comment, | |||
bool | isExact | |||
) | const |
Add value and text as a comment to current tracenode.
Definition at line 115 of file SgSearchTracer.cpp.
References SgNode::Add(), m_traceNode, SG_PROP_CHECK, TraceComment(), and TraceValue().
SgNode* SgSearchTracer::m_traceNode [protected] |
Current node in tracing.
Definition at line 66 of file SgSearchTracer.h.
Referenced by AddTraceNode(), AppendTrace(), InitTracing(), StartOfDepth(), TakeBackTraceNode(), TraceComment(), TraceNode(), and TraceValue().