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>

List of all members.

Public Member Functions

 GChessMoveIterator ()
 Constructs a move iterator. (Doesn't call Reset, so you must still call Reset before you call GetNextMove).
 ~GChessMoveIterator ()
void reset (GChessBoard *pBoard, bool white, GRand *pRand)
 Resets the iterator and specifies the color whose moves you wish to iterate.
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)

Protected Attributes

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

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_moves[2 *MAX_PIECE_MOVES] [protected]