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


C++ Move类代码示例

本文整理汇总了C++中Move的典型用法代码示例。如果您正苦于以下问题:C++ Move类的具体用法?C++ Move怎么用?C++ Move使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Move类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sideToMove

void OukBoard::updateCounter(Move m, int increment)
{
	Side side = sideToMove();
	int source = m.sourceSquare();
	int target= m.targetSquare();

	if (source == m_initialSquare[side][King]
	||  target == m_initialSquare[side][King])
		m_moveCount[side][King] += increment;

	if (source == m_initialSquare[side][Maiden]
	||  target == m_initialSquare[side][Maiden])
		m_moveCount[side][Maiden] += increment;
}
开发者ID:cutechess,项目名称:cutechess,代码行数:14,代码来源:oukboard.cpp

示例2: applyMoveToParticles

void MonteCarlo::updateFilter(Move delta, vector<Observation>& obs) {
	applyMoveToParticles(delta);

	if ( obs.size() != 0 && ( delta.getX() == 0 && delta.getY() == 0 && delta.getTheta() == 0))
	  updateParticleProbabilities(obs);

	resample();

	//TODO: do not do it twice
	//we are doing it in resample but before introducing new particles.
	normalizeParticleProbabilities();

	debug(obs);
}
开发者ID:aozgelen,项目名称:rteam,代码行数:14,代码来源:MonteCarlo.cpp

示例3: play

void Board::play(const Move& m)
{
	if (!m.isValid(this))
	{
		QMessageBox::critical(NULL, "Invalid move", "Invalid move");
		return;
	}

	m.updateBoard(this);
	nbMovesLeft_--;

	undo_.addState(stateString());
	blackPlays_ = !blackPlays_;
}
开发者ID:nhatson1987,项目名称:libQGLViewer-2.5.2,代码行数:14,代码来源:board.cpp

示例4: NoParameters

void ICP::DcGS(void) const
{
  // Go search

  NoParameters();
  if (IsGameOver()) ReportGameOver();
  else
  {
    Move move;

    FindMove(move);
    PrintFSL(fsLbMove); move.Print(stateptr->FetchSearchFEnv()); PrintNL();
  };
}
开发者ID:arthurjeng,项目名称:Deep-Blue-and-Gold,代码行数:14,代码来源:ICPCommands.cpp

示例5: TEST

TEST(AttackTest, AttackTargetBug) {
    MyBot bot;
    ifstream state("test/test6.log");
    parse_state(bot, state);

    Move move;
    move.add(FutureOrder(ally, 30, 2, 5, 3));

    Simulator sim(bot.game(), bot.map(), 0);
    sim.simulate(move, SIM_DEPTH, true);

    vector<target_t> targets = sim.select_targets(ally);
    EXPECT_TRUE(std::find_if(targets.begin(), targets.end(), target_kind_comp(attack)) == targets.end());
}
开发者ID:zvold,项目名称:planetwars-bot-cpp,代码行数:14,代码来源:attacktest.cpp

示例6: if

void
Position::doMove(Lookup& lookup, Move const& move)
{
	Square to = move.to();

	if (move.isCastling())
	{
		sq::Rank	rank		= sq::rank(to);
		Byte		pieceNum	= lookup[move.from()];

		if (move.isShortCastling())
		{
			lookup[sq::make(sq::FyleF, rank)] = m_rookNumbers[castling::kingSideIndex(move.color())];
			lookup[sq::make(sq::FyleG, rank)] = pieceNum;
		}
		else
		{
			lookup[sq::make(sq::FyleD, rank)] = m_rookNumbers[castling::queenSideIndex(move.color())];
			lookup[sq::make(sq::FyleC, rank)] = pieceNum;
		}
	}
	else if (__builtin_expect(!move.isNull(), 0))
	{
		lookup[to] = lookup[move.from()];
	}
}
开发者ID:gkalab,项目名称:cb2pgn,代码行数:26,代码来源:sci_encoder_position.cpp

示例7: commandExecuted

void GameWindow::commandExecuted(Move& cmd){
   
   	if( this->serverProxy->getMe() == cmd.getTo() )
		messageLabel.setText(cmd.getMainMsg());
	else
		messageLabel.setText(cmd.getSecMsg());
		
	if ( cmd.isValid() ){	
		//cambia estado a populating 
		ReferenceCountPtr<ClientState> popu = new ClientPopulating(*this);
		this->setState(popu);
	}
	//sino es valido sigo en mismo estado
}
开发者ID:lautaroezequielrinaldi,项目名称:risk-3d,代码行数:14,代码来源:gamewindow.cpp

示例8: DoFutilityPruning01

	virtual inline void DoFutilityPruning01(
		bool& isContinue,
		bool& INCHECK,
		bool& givesCheck,
		Move& move,
		Move& ttMove,
		ScoreIndex& futilityScore,
		ScoreIndex& futilityBase,
		Position& pos,
		ScoreIndex& beta,
		ScoreIndex& bestScore,
		const Depth depth
		)const override {
		// 非PVノードのとき☆(^q^)
		if (!INCHECK // 駒打ちは王手回避のみなので、ここで弾かれる。
			&& !givesCheck
			&& move != ttMove)
		{
			futilityScore =
				futilityBase + PieceScore::GetCapturePieceScore(pos.GetPiece(move.To()));
			if (move.IsPromotion()) {
				futilityScore += PieceScore::GetPromotePieceScore(move.GetPieceTypeFrom());
			}

			if (futilityScore < beta) {
				bestScore = std::max(bestScore, futilityScore);
				isContinue = true;
				return;
			}

			// todo: MovePicker のオーダリングで SEE してるので、ここで SEE するの勿体無い。
			if (futilityBase < beta
				&& depth < Depth0
				&&
				(
					pos.GetTurn()==Color::Black
					?
					pos.GetSee1<Color::Black,Color::White>(move, beta - futilityBase)
					:
					pos.GetSee1<Color::White,Color::Black>(move, beta - futilityBase)
					)
				<= ScoreZero)
			{
				bestScore = std::max(bestScore, futilityBase);
				isContinue = true;
				return;
			}
		}
	}
开发者ID:muzudho,项目名称:Kifuwarapery,代码行数:49,代码来源:n885_330_hitchhikerQsearchNonPv.hpp

示例9: getMoveProperty

bool SGFNode::getMoveProperty(vector<Move>& m, string prop, int colour) const
{
	vector<string> p;
	if(!getProperty(prop, p))
		return false;
	m.clear();
	Move move;
	for(int i=0;i<p.size();i++) {
		move.setX(Move::SGFToX(p.at(i)));
		move.setY(Move::SGFToY(p.at(i)));
		move.setColour(colour);
		m.push_back(move);
	}
	return true;
}
开发者ID:julianchurchill,项目名称:Melkor,代码行数:15,代码来源:SGFNode.cpp

示例10: MoveToStr

string MoveToStr(Move mv)
{
  string s = FldToStr(mv.From()) + FldToStr(mv.To());

  switch (mv.Promotion())
  {
    case QW: case QB: s += "q"; break;
    case RW: case RB: s += "r"; break;
    case BW: case BB: s += "b"; break;
    case NW: case NB: s += "n"; break;
    default: break;
  }

  return s;
}
开发者ID:WinPooh,项目名称:pgnlearn,代码行数:15,代码来源:notation.cpp

示例11: testMove

bool ConnectFour::Board::addMove(const Move& move)
{
    if(!isInBounds(move))
        return false;

    m_solved = m_solved || testMove(move);
    m_board[move.column()].push_back(move.player());

    if(m_solved)
        m_winningPlayer = &(move.player());
    if(m_board[move.column()].size() == COLUMN_SIZE)
        ++m_filledColumns;

    return m_solved;
}
开发者ID:wallstop,项目名称:MonteCarloFramework,代码行数:15,代码来源:ConnectFour.cpp

示例12: main

int main()
{
	Move one(5,12.5);
	Move two(0,2.50);

	Move three =one.add(two);
	cout<<"Move Three (one+two) :" <<endl;
	three.showmove();

	cout << "Reset Move Three :" << endl;
	three.reset();
	three.showmove();

	return 0;
}
开发者ID:muhammadnash,项目名称:Assignment01,代码行数:15,代码来源:Move.cpp

示例13: LOG_INFO

void Machine::move(const Move &move) {
  // Measure
  distance += move.getDistance();
  time += move.getTime();

  // Output
  if (moveStream.isNull() && !outputMoves.empty()) {
    if (outputMoves == "-") moveStream = SmartPointer<ostream>::Phony(&cout);
    else moveStream = SystemUtilities::oopen(outputMoves);
  }

  if (!moveStream.isNull()) *moveStream << move << endl;

  LOG_INFO(3, "Machine: Move to " << move.getEndPt());
}
开发者ID:Akfreak,项目名称:OpenSCAM,代码行数:15,代码来源:Machine.cpp

示例14: ASSERT

inline void Board::PlayLegal (const Move& move) {
	ASSERT(IsValidMove(move));
	uint pos = move.GetLocation().GetPos();
	if (move.GetPlayer() == Player::First()) {
		_board[pos] = pos;
		MakeUnion(pos);
	} else {
		_board[pos] = -1;
	}
	uint fast_map_pos = _reverse_fast_field_map[pos];
	uint replace_pos = _fast_field_map[--_moves_left];
	_fast_field_map[fast_map_pos] = replace_pos;
	_reverse_fast_field_map[replace_pos] = fast_map_pos;
	_current = _current.Opponent();
}
开发者ID:lukaszlew,项目名称:MiMHex,代码行数:15,代码来源:board.cpp

示例15: psudoLegalBishop

/*
 * Returns true if s1-s2 is a psudo legal bishop move.
 * This is the case if the move changes rank and file
 * the same amount, and no piece is blocking the way.
 */
bool Position::psudoLegalBishop(Move m) {
  Square s1 = m.getFrom(), s2 = m.getTo();
  int d_rank = rank_diff(s1, s2);
  int d_file = file_diff(s1, s2);
  if (abs(d_rank) != abs(d_file)) return false;

  int rank_sign = d_rank < 0 ? -1 : 1;
  int file_sign = d_file < 0 ? -1 : 1;
  for (int i = 1; i < abs(d_file); i++) {
    if (occupied(Square(s1 + i*D_EAST*file_sign + i*D_NORTH*rank_sign))) {
      return false;
    }
  }
  return true;
}
开发者ID:bsamseth,项目名称:Goldfish,代码行数:20,代码来源:position.cpp


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