本文整理汇总了C++中Operation::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Operation::set方法的具体用法?C++ Operation::set怎么用?C++ Operation::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_bot_left_jump
/*
Bottom Left Jump
*/
bool check_bot_left_jump(Game *game, Point &start, Operation &op) {
// check eligible for jumping
if(start.j >= 2 && start.i <= (GAME_GRID_NUM - 3)) {
Point jp = Point(start.i + 2, start.j - 2);
// the jump piece can be placed
if(game->get(jp) == EMPTY_DARK_SQUARE) {
Point p = Point(start.i + 1, start.j - 1);
// Alice jump
if(game->get(start) == ALICE_KING) {
// eliminate Bill's piece
if(game->get(p) == BILL_PIECE || game->get(p) == BILL_KING) {
op.set(start, jp, ALICE_MOVE, JUMP_MOVE);
return true;
}
}
// Bill jump
if(game->get(start) == BILL_KING || game->get(start) == BILL_PIECE) {
// eliminate Alice's piece
if(game->get(p) == ALICE_PIECE || game->get(p) == ALICE_KING) {
op.set(start, jp, BILL_MOVE, JUMP_MOVE);
return true;
}
}
}
}
return false;
}
示例2: check_bot_left_move
/*
Bottom Left Move
*/
bool check_bot_left_move(Game *game, Point &start, Operation & op) {
// check eligible for moving
if(start.j >= 1 && start.i <= (GAME_GRID_NUM - 2)) {
Point mp = Point(start.i + 1, start.j - 1);
// the move piece can be placed
if(game->get(mp) == EMPTY_DARK_SQUARE) {
// Alice move
if(game->get(start) == ALICE_KING) {
op.set(start, mp, ALICE_MOVE, NORMAL_MOVE);
return true;
}
// Bill move
if(game->get(start) == BILL_KING || game->get(start) == BILL_PIECE) {
op.set(start, mp, BILL_MOVE, NORMAL_MOVE);
return true;
}
}
}
return false;
}