Ejemplo n.º 1
0
/*
 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;
}
Ejemplo n.º 2
0
/*
 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;
}