Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes

SgSortedMoves< MOVE, VALUE, SIZE > Class Template Reference

Small array with moves sorted by their value. More...

#include <SgSortedMoves.h>

List of all members.

Public Member Functions

 SgSortedMoves (int maxNuMoves)
void CheckOverflow ()
void Clear ()
void DeleteEqual ()
 delete all but one of equal-valued moves
void Delete (int index)
 Delete move at index.
void Insert (const MOVE &move, VALUE value)
 Insert move with given value in table.
bool GetMove (const MOVE &move, VALUE &value, int &index) const
void GetMoves (SgVector< MOVE > *moves) const
void SetMinValue (const MOVE &move, VALUE value)
 If move in table: increase its value.
void SetMove (int i, const MOVE &move)
void SetValue (int i, VALUE value)
void SetMaxMoves (int nu)
 Adjust number of moves: throw out all moves whose value has become less than the value of m_move[m_maxNuMoves - 1].
void SetMaxNuMoves (int max)
 Limit number of moves.
void SetLowerBound (VALUE bound)
 Lower bound for accepting moves.
void SetInitLowerBound (VALUE bound)
 See m_initLowerBound.
int LowerBound () const
int NuMoves () const
int MaxNuMoves () const
const MOVE & Move (int i) const
 Get move at given index i.
const MOVE & BestMove () const
 The best move is sorted first in the table.
VALUE Value (int i) const
VALUE BestValue () const
void DecNuMoves ()
void AssertIndexRange (int i) const
 Assert i is an index within the table.
void Shuffle ()
 randomly shuffle all the moves of equal value.

Static Public Attributes

static const bool CHECKMOVES = SG_CHECK
 check move table before and after each operation

Private Member Functions

void CheckMoves () const
void ShuffleInterval (int from, int to)
 Randomly shuffle all moves in interval.

Private Attributes

int m_maxNuMoves
int m_nuMoves
VALUE m_lowerBound
 Lower bound for accepting moves.
VALUE m_initLowerBound
 Initial value of m_lowerBound after a Clear().
bool m_checkOverflow
bool m_considerEqual
MOVE m_move [SIZE]
VALUE m_value [SIZE]

Detailed Description

template<typename MOVE, typename VALUE, int SIZE>
class SgSortedMoves< MOVE, VALUE, SIZE >

Small array with moves sorted by their value.

Definition at line 20 of file SgSortedMoves.h.


Constructor & Destructor Documentation

template<typename MOVE , typename VALUE , int SIZE>
SgSortedMoves< MOVE, VALUE, SIZE >::SgSortedMoves ( int  maxNuMoves  )  [explicit]

Definition at line 156 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::Clear(), and SG_ASSERT.


Member Function Documentation

template<typename MOVE, typename VALUE, int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::AssertIndexRange ( int  i  )  const
template<typename MOVE, typename VALUE, int SIZE>
const MOVE& SgSortedMoves< MOVE, VALUE, SIZE >::BestMove (  )  const

The best move is sorted first in the table.

Definition at line 94 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::Move().

template<typename MOVE, typename VALUE, int SIZE>
VALUE SgSortedMoves< MOVE, VALUE, SIZE >::BestValue (  )  const
template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::CheckMoves (  )  const [private]
template<typename MOVE, typename VALUE, int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::CheckOverflow (  ) 
template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::Clear (  ) 
template<typename MOVE, typename VALUE, int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::DecNuMoves (  ) 

Definition at line 107 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::m_nuMoves, and SG_ASSERT.

template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::Delete ( int  index  ) 
template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::DeleteEqual (  ) 
template<typename MOVE , typename VALUE , int SIZE>
bool SgSortedMoves< MOVE, VALUE, SIZE >::GetMove ( const MOVE &  move,
VALUE &  value,
int &  index 
) const
template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::GetMoves ( SgVector< MOVE > *  moves  )  const
template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::Insert ( const MOVE &  move,
VALUE  value 
)
template<typename MOVE, typename VALUE, int SIZE>
int SgSortedMoves< MOVE, VALUE, SIZE >::LowerBound (  )  const

Definition at line 82 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::m_lowerBound.

template<typename MOVE, typename VALUE, int SIZE>
int SgSortedMoves< MOVE, VALUE, SIZE >::MaxNuMoves (  )  const

Definition at line 88 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::m_maxNuMoves.

template<typename MOVE, typename VALUE, int SIZE>
const MOVE& SgSortedMoves< MOVE, VALUE, SIZE >::Move ( int  i  )  const
template<typename MOVE, typename VALUE, int SIZE>
int SgSortedMoves< MOVE, VALUE, SIZE >::NuMoves (  )  const

Definition at line 85 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::m_nuMoves.

Referenced by operator<<().

template<typename MOVE, typename VALUE, int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::SetInitLowerBound ( VALUE  bound  ) 

See m_initLowerBound.

Definition at line 79 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::m_initLowerBound.

template<typename MOVE, typename VALUE, int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::SetLowerBound ( VALUE  bound  ) 

Lower bound for accepting moves.

Definition at line 76 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::m_lowerBound.

template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::SetMaxMoves ( int  nu  ) 
template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::SetMaxNuMoves ( int  max  ) 

Limit number of moves.

Definition at line 353 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::m_maxNuMoves, and SG_ASSERT.

Referenced by SgSortedMoves< MOVE, VALUE, SIZE >::SetMaxMoves().

template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::SetMinValue ( const MOVE &  move,
VALUE  value 
)

If move in table: increase its value.

otherwise insert (move,value)

Definition at line 334 of file SgSortedMoves.h.

References SgSortedMoves< MOVE, VALUE, SIZE >::Delete(), SgSortedMoves< MOVE, VALUE, SIZE >::GetMove(), and SgSortedMoves< MOVE, VALUE, SIZE >::Insert().

template<typename MOVE, typename VALUE, int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::SetMove ( int  i,
const MOVE &  move 
)
template<typename MOVE, typename VALUE, int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::SetValue ( int  i,
VALUE  value 
)
template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::Shuffle (  ) 
template<typename MOVE , typename VALUE , int SIZE>
void SgSortedMoves< MOVE, VALUE, SIZE >::ShuffleInterval ( int  from,
int  to 
) [private]
template<typename MOVE, typename VALUE, int SIZE>
VALUE SgSortedMoves< MOVE, VALUE, SIZE >::Value ( int  i  )  const

Member Data Documentation

template<typename MOVE, typename VALUE, int SIZE>
const bool SgSortedMoves< MOVE, VALUE, SIZE >::CHECKMOVES = SG_CHECK [static]

check move table before and after each operation

Definition at line 24 of file SgSortedMoves.h.

Referenced by SgSortedMoves< MOVE, VALUE, SIZE >::Delete(), and SgSortedMoves< MOVE, VALUE, SIZE >::Insert().

template<typename MOVE, typename VALUE, int SIZE>
bool SgSortedMoves< MOVE, VALUE, SIZE >::m_checkOverflow [private]
template<typename MOVE, typename VALUE, int SIZE>
bool SgSortedMoves< MOVE, VALUE, SIZE >::m_considerEqual [private]
template<typename MOVE, typename VALUE, int SIZE>
VALUE SgSortedMoves< MOVE, VALUE, SIZE >::m_initLowerBound [private]
template<typename MOVE, typename VALUE, int SIZE>
VALUE SgSortedMoves< MOVE, VALUE, SIZE >::m_lowerBound [private]
template<typename MOVE, typename VALUE, int SIZE>
int SgSortedMoves< MOVE, VALUE, SIZE >::m_maxNuMoves [private]
template<typename MOVE, typename VALUE, int SIZE>
MOVE SgSortedMoves< MOVE, VALUE, SIZE >::m_move[SIZE] [private]
template<typename MOVE, typename VALUE, int SIZE>
int SgSortedMoves< MOVE, VALUE, SIZE >::m_nuMoves [private]
template<typename MOVE, typename VALUE, int SIZE>
VALUE SgSortedMoves< MOVE, VALUE, SIZE >::m_value[SIZE] [private]

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


Sun Mar 13 2011 Doxygen 1.7.1