本文整理汇总了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;
}
示例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);
}
示例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_;
}
示例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();
};
}
示例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());
}
示例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()];
}
}
示例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
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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();
}
示例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;
}