Board evaluation based on circuit flow. More...
#include <Resistance.hpp>
Public Member Functions | |
| Resistance () | |
| Constructor. | |
| virtual | ~Resistance () |
| Destructor. | |
| bool | SimulateAndOverEdge () const |
| void | SetSimulateAndOverEdge (bool enable) |
| void | Evaluate (const HexBoard &brd) |
| Computes the evaluation for the given boardstate; uses ResistanceUtil::AddAdjacencies() to compute the conductance graphs for this board. | |
| void | Evaluate (const HexBoard &brd, AdjacencyGraph graph[BLACK_AND_WHITE]) |
| Computes the evaluation for the given boardstate with the given AdjacencyGraphs for each color. | |
| void | Evaluate (const Groups &groups, AdjacencyGraph graph[BLACK_AND_WHITE]) |
| Evaluate on the given groups with the given adjacency graph. | |
| double | Resist (HexColor color) const |
| Returns the log(resistance) for the given color. | |
| HexEval | Score () const |
| Returns the resistance of the board position from BLACK's view. | |
| HexEval | Score (HexPoint cell, HexColor color) const |
| Returns the score for cell and color. | |
| HexEval | Score (HexPoint cell) const |
| Returns the sum of the BLACK and WHITE scores for this cell. | |
Private Member Functions | |
| void | ComputeScores (HexColor color, const Groups &brd, const AdjacencyGraph &graph, const ConductanceValues &values, HexEval *out) |
| Compute the evaluation for a single color. | |
| void | ComputeScore () |
| Returns score as a ration of black's score over white's. | |
Private Attributes | |
| HexEval | m_score |
| HexEval | m_resistance [BLACK_AND_WHITE] |
| HexEval | m_scores [BLACK_AND_WHITE][BITSETSIZE] |
| bool | m_simulate_and_over_edge |
Board evaluation based on circuit flow.
Definition at line 82 of file Resistance.hpp.
| Resistance::Resistance | ( | ) | [explicit] |
Constructor.
Definition at line 43 of file Resistance.cpp.
| Resistance::~Resistance | ( | ) | [virtual] |
Destructor.
Definition at line 49 of file Resistance.cpp.
| void Resistance::ComputeScore | ( | ) | [private] |
Returns score as a ration of black's score over white's.
Definition at line 186 of file Resistance.cpp.
References BLACK, m_resistance, m_score, and WHITE.
Referenced by Evaluate().
| void Resistance::ComputeScores | ( | HexColor | color, | |
| const Groups & | brd, | |||
| const AdjacencyGraph & | graph, | |||
| const ConductanceValues & | values, | |||
| HexEval * | out | |||
| ) | [private] |
Compute the evaluation for a single color.
Definition at line 118 of file Resistance.cpp.
References BITSETSIZE, Groups::Board(), HexPointUtil::colorEdge1(), HexPointUtil::colorEdge2(), HexColorSetUtil::ColorOrEmpty(), lsSolve(), m_resistance, and Groups::NumGroups().
Referenced by Evaluate().
| void Resistance::Evaluate | ( | const Groups & | groups, | |
| AdjacencyGraph | graph[BLACK_AND_WHITE] | |||
| ) |
Evaluate on the given groups with the given adjacency graph.
Definition at line 76 of file Resistance.cpp.
References ComputeScore(), ComputeScores(), and m_scores.
| void Resistance::Evaluate | ( | const HexBoard & | brd, | |
| AdjacencyGraph | graph[BLACK_AND_WHITE] | |||
| ) |
Computes the evaluation for the given boardstate with the given AdjacencyGraphs for each color.
Definition at line 62 of file Resistance.cpp.
References ComputeScore(), ComputeScores(), HexBoard::GetGroups(), m_scores, m_simulate_and_over_edge, and SimulateAndOverEdge().
| void Resistance::Evaluate | ( | const HexBoard & | brd | ) |
Computes the evaluation for the given boardstate; uses ResistanceUtil::AddAdjacencies() to compute the conductance graphs for this board.
Definition at line 55 of file Resistance.cpp.
References ResistanceUtil::AddAdjacencies(), and BLACK_AND_WHITE.
Referenced by BenzeneHtpEngine::CmdEvalResist(), BenzeneHtpEngine::CmdEvalResistDelta(), WolveSearch::ComputeResistance(), DfpnSolver::MID(), and MoHexPlayer::PerformPreSearch().
| double Resistance::Resist | ( | HexColor | color | ) | const |
Returns the log(resistance) for the given color.
Definition at line 192 of file Resistance.cpp.
References m_resistance.
Referenced by BenzeneHtpEngine::CmdEvalResist().
Returns the score for cell and color.
A cells score is equal to the current flowing through it.
Definition at line 177 of file Resistance.hpp.
References m_scores.
| HexEval Resistance::Score | ( | ) | const [inline] |
Returns the resistance of the board position from BLACK's view.
That is, the log of the white resistance over the black resistance.
Definition at line 166 of file Resistance.hpp.
References m_score.
Referenced by BenzeneHtpEngine::CmdEvalResist(), BenzeneHtpEngine::CmdEvalResistDelta(), WolveSearch::Evaluate(), WolveSearch::GenerateMoves(), and DfpnSolver::MID().
| void Resistance::SetSimulateAndOverEdge | ( | bool | enable | ) | [inline] |
Definition at line 161 of file Resistance.hpp.
References m_simulate_and_over_edge.
| bool Resistance::SimulateAndOverEdge | ( | ) | const [inline] |
Definition at line 156 of file Resistance.hpp.
References m_simulate_and_over_edge.
Referenced by Evaluate().
HexEval Resistance::m_resistance[BLACK_AND_WHITE] [private] |
Definition at line 150 of file Resistance.hpp.
Referenced by ComputeScore(), ComputeScores(), and Resist().
HexEval Resistance::m_score [private] |
Definition at line 149 of file Resistance.hpp.
Referenced by ComputeScore(), and Score().
HexEval Resistance::m_scores[BLACK_AND_WHITE][BITSETSIZE] [private] |
Definition at line 151 of file Resistance.hpp.
Referenced by Evaluate(), and Score().
bool Resistance::m_simulate_and_over_edge [private] |
Definition at line 153 of file Resistance.hpp.
Referenced by Evaluate(), SetSimulateAndOverEdge(), and SimulateAndOverEdge().