GClasses
GClasses::GChessMoveIterator Class Reference

Iterates through all the possible moves for the specified color. It iterates through the pieces in a random order. It also iterates through the moves for each piece in a random order, but it will visit each move for the current piece before considering the next piece. More...

#include <GChess.h>

Public Member Functions

 GChessMoveIterator ()
 Constructs a move iterator. (Doesn't call Reset, so you must still call Reset before you call GetNextMove). More...
 
 ~GChessMoveIterator ()
 
bool nextMove (int *xSrc, int *ySrc, int *xDest, int *yDest)
 Gets the next possible move for the specified color. Returns false if there are no more moves (so the values in xSrc, ySrc, xDest, and yDest are bogus) More...
 
void reset (GChessBoard *pBoard, bool white, GRand *pRand)
 Resets the iterator and specifies the color whose moves you wish to iterate. More...
 

Protected Attributes

int m_move
 
int m_moveCount
 
int m_moves [2 *MAX_PIECE_MOVES]
 
int m_n
 
int m_order [64]
 
GChessBoardm_pBoard
 
GRandm_pRand
 
bool m_white
 

Detailed Description

Iterates through all the possible moves for the specified color. It iterates through the pieces in a random order. It also iterates through the moves for each piece in a random order, but it will visit each move for the current piece before considering the next piece.

Constructor & Destructor Documentation

GClasses::GChessMoveIterator::GChessMoveIterator ( )

Constructs a move iterator. (Doesn't call Reset, so you must still call Reset before you call GetNextMove).

GClasses::GChessMoveIterator::~GChessMoveIterator ( )

Member Function Documentation

bool GClasses::GChessMoveIterator::nextMove ( int *  xSrc,
int *  ySrc,
int *  xDest,
int *  yDest 
)

Gets the next possible move for the specified color. Returns false if there are no more moves (so the values in xSrc, ySrc, xDest, and yDest are bogus)

void GClasses::GChessMoveIterator::reset ( GChessBoard pBoard,
bool  white,
GRand pRand 
)

Resets the iterator and specifies the color whose moves you wish to iterate.

Member Data Documentation

int GClasses::GChessMoveIterator::m_move
protected
int GClasses::GChessMoveIterator::m_moveCount
protected
int GClasses::GChessMoveIterator::m_moves[2 *MAX_PIECE_MOVES]
protected
int GClasses::GChessMoveIterator::m_n
protected
int GClasses::GChessMoveIterator::m_order[64]
protected
GChessBoard* GClasses::GChessMoveIterator::m_pBoard
protected
GRand* GClasses::GChessMoveIterator::m_pRand
protected
bool GClasses::GChessMoveIterator::m_white
protected