本文整理汇总了C++中Counter::GetColour方法的典型用法代码示例。如果您正苦于以下问题:C++ Counter::GetColour方法的具体用法?C++ Counter::GetColour怎么用?C++ Counter::GetColour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Counter
的用法示例。
在下文中一共展示了Counter::GetColour方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsFinished
bool BoardEvaluator::IsFinished(Board &board, Colour *winningColour) {
for (unsigned int i = 0; i < WIDTH; i++) {
for (unsigned int j = 0; j < HEIGHT; j++) {
Counter *counter = board.Space(i, j);
if (counter != NULL) {
// creating the dirctions to be searched in.
North north(i, j);
South south(i, j);
East east(i, j);
West west(i, j);
NorthEast northEast(i, j);
NorthWest northWest(i, j);
SouthEast southEast(i, j);
SouthWest southWest(i, j);
bool retVal = false;
Colour retCol = NULL_COLOUR;
unsigned int conLength = CONNECT_LENGTH;
Colour colour = (Colour)counter->GetColour();
if (RecursiveSearch(colour, &north, conLength - 1, board)) {
retCol = colour;
retVal = true;
}
if (RecursiveSearch(colour, &south, conLength - 1, board)) {
retCol = colour;
retVal = true;
}
if (RecursiveSearch(colour, &east, conLength - 1, board)) {
retCol = colour;
retVal = true;
}
if (RecursiveSearch(colour, &west, conLength - 1, board)) {
retCol = colour;
retVal = true;
}
if (RecursiveSearch(colour, &northEast, conLength - 1, board)) {
retCol = colour;
retVal = true;
}
if (RecursiveSearch(colour, &northWest, conLength - 1, board)) {
retCol = colour;
retVal = true;
}
if (RecursiveSearch(colour, &southEast, conLength - 1, board)) {
retCol = colour;
retVal = true;
}
if (RecursiveSearch(colour, &southWest, conLength - 1, board)) {
retCol = colour;
retVal = true;
}
if (retVal) {
*winningColour = retCol;
return true;
}
}
}
}
return false;
}