当前位置: 首页>>代码示例>>C++>>正文


C++ Neighbors::end方法代码示例

本文整理汇总了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;
}
开发者ID:hknexgen,项目名称:morris,代码行数:8,代码来源:Board.cpp

示例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); 
    }
} 
开发者ID:albertasd,项目名称:ctl,代码行数:20,代码来源:incremental_complex.hpp

示例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;
}
开发者ID:hknexgen,项目名称:morris,代码行数:13,代码来源:Board.cpp

示例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;
}
开发者ID:hknexgen,项目名称:morris,代码行数:15,代码来源:Board.cpp

示例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;
}
开发者ID:hknexgen,项目名称:morris,代码行数:23,代码来源:MoveGenerator.cpp

示例6: isNeighbor

bool Board::isNeighbor(int lhs, int rhs)
{
	const Neighbors neighbors = getNeighbors(lhs);
	return find(neighbors.begin(), neighbors.end(), rhs) != neighbors.end();
}
开发者ID:hknexgen,项目名称:morris,代码行数:5,代码来源:Board.cpp


注:本文中的Neighbors::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。