本文整理汇总了C++中Neighbors::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Neighbors::end方法的具体用法?C++ Neighbors::end怎么用?C++ Neighbors::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Neighbors
的用法示例。
在下文中一共展示了Neighbors::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isBlocked
bool Board::isBlocked(int pos) const
{
Neighbors neighbors = getNeighbors(pos);
for(Neighbors::const_iterator it = neighbors.begin(); it != neighbors.end(); ++it)
if(chessmen[*it] == 'x') // try to find an empty neighbor
return false;
return true;
}
示例2: add_cofaces
void add_cofaces (const Graph& graph, Simplex& tau,
const Neighbors& neighbors,
Complex& complex, const std::size_t dimension) {
typedef typename Neighbors::const_iterator Neighbor_iterator;
complex.insert_open_cell(tau);
if(tau.dimension() >= dimension) { return; }
Neighbors lower_neighbors;
Neighbors final_neighbors;
for(Neighbor_iterator i = neighbors.begin(); i != neighbors.end(); ++i){
lower_neighbors.clear();
Simplex sigma( tau);
sigma.insert( *i);
get_lower_neighbors(graph, *i, lower_neighbors);
final_neighbors.clear();
set_intersection(lower_neighbors.begin(),lower_neighbors.end(),
neighbors.begin(),neighbors.end(),
back_inserter(final_neighbors));
add_cofaces(graph, sigma, final_neighbors, complex, dimension);
}
}
示例3: countFreedom
int Board::countFreedom(QChar color) const
{
int result = 0;
for(int i=0; i<23; ++i)
if(chessmen[i] == color)
{
Neighbors neighbors = getNeighbors(i);
for(Neighbors::const_iterator it = neighbors.begin(); it != neighbors.end(); ++it)
if(chessmen[*it] == 'x') // empty
result ++;
}
return result;
}
示例4: closeMorris
bool Board::closeMorris(int pos) const
{
Neighbors neighbors = getNeighbors(pos);
for(Neighbors::const_iterator it = neighbors.begin(); it != neighbors.end(); ++it)
{
if(chessmen[*it] == 'x') // for all it's empty neighbor
{
Board temp(*this);
temp.move(pos, *it); // move to this neighbor
if(temp.closeMill(*it))
return true;
}
}
return false;
}
示例5: generateMove
Moves MoveGenerator::generateMove(const Board& board) const
{
Moves result;
for(int from=0; from<23; ++from)
if(board.getManAt(from) == board.getSelfColor())
{
Neighbors neighbors = Board::getNeighbors(from);
for(Neighbors::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
if(board.isEmpty(*it))
{
Board next = board.makeChild();
next.move(from, *it);
if(next.closeMill(*it))
{
Moves removeMoves = generateRemove(next, board.getOpponentColor());
copy(removeMoves.begin(), removeMoves.end(), back_inserter(result));
}
else
result.push_back(next);
}
}
return result;
}
示例6: isNeighbor
bool Board::isNeighbor(int lhs, int rhs)
{
const Neighbors neighbors = getNeighbors(lhs);
return find(neighbors.begin(), neighbors.end(), rhs) != neighbors.end();
}