Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

Resistance Class Reference

Board evaluation based on circuit flow. More...

#include <Resistance.hpp>

List of all members.

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

Detailed Description

Board evaluation based on circuit flow.

Definition at line 82 of file Resistance.hpp.


Constructor & Destructor Documentation

Resistance::Resistance (  )  [explicit]

Constructor.

Definition at line 43 of file Resistance.cpp.

Resistance::~Resistance (  )  [virtual]

Destructor.

Definition at line 49 of file Resistance.cpp.


Member Function Documentation

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.

Note:
Graphs are not constant because if "resist-simulate-and-over-edge" is true, the graphs will be augmented. Augmentation is done here so that it is done only one spot, as opposed to having the augmentation done in all spots calling Evaluate().

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().

HexEval Resistance::Score ( HexPoint  cell  )  const [inline]

Returns the sum of the BLACK and WHITE scores for this cell.

Todo:
How to handle bad cells?

Definition at line 171 of file Resistance.hpp.

References BLACK, m_scores, and WHITE.

HexEval Resistance::Score ( HexPoint  cell,
HexColor  color 
) const [inline]

Returns the score for cell and color.

A cells score is equal to the current flowing through it.

Todo:
How to handle bad cells?

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().


Member Data Documentation

Definition at line 150 of file Resistance.hpp.

Referenced by ComputeScore(), ComputeScores(), and Resist().

Definition at line 149 of file Resistance.hpp.

Referenced by ComputeScore(), and Score().

Definition at line 151 of file Resistance.hpp.

Referenced by Evaluate(), and Score().

Definition at line 153 of file Resistance.hpp.

Referenced by Evaluate(), SetSimulateAndOverEdge(), and SimulateAndOverEdge().


The documentation for this class was generated from the following files:


6 Jan 2011 Doxygen 1.6.3