Beispiel #1
0
void Board::moveStone(int moveid, int killid, int row, int col)
{
    saveStep(moveid, killid, row, col, _steps);

    killStone(killid);
    moveStone(moveid, row, col);
}
Beispiel #2
0
void GameStartLayer::ccTouchEnded(CCTouch *touch, CCEvent *)
{
	if (_selectid == -1)
	{
		//! 选中
		selectStone(touch);
	}
	else
	{
		//! 移动
		moveStone(touch);
	}
}
Beispiel #3
0
void Board::tryMoveStone(int killid, int row, int col)
{
    if (killid != -1 && sameColor(killid, _selectid)) {
        trySelectStone(killid);
        return;
    }

    bool ret = canMove(_selectid, killid, row, col);
    if (ret) {
        moveStone(_selectid, killid, row, col);
        _selectid = -1;
        update();
    }
}
Beispiel #4
0
void NMPT_simulator::buildModel(int iterations_number)
{
    stone_trajectory.resize(iterations_number);
    duck_trajectory.resize(iterations_number);

    max_iter_achieved = iterations_number;

    stone_trajectory[0].x = 0;
    stone_trajectory[0].y=0;
    stone_trajectory[0].Vx = qCos(qDegreesToRadians(alpha))*V;
    stone_trajectory[0].Vy = qSin(qDegreesToRadians(alpha))*V;

    duck_trajectory[0].x = dX0;
    duck_trajectory[0].Vx = U;

    closest_encounter.first = dX0;
    closest_encounter.second = 0;

    for(int i=1; i<iterations_number; i++)
    {
        moveDuck(i);
        moveStone(i);

        if(stone_trajectory[i].y < 0)
        {
            max_iter_achieved = i;
            resize_trajectory(i);
            break;
        }

        if(abs(stone_trajectory[i].x - duck_trajectory[i].x) < closest_encounter.first)
        {
            closest_encounter.first = abs(stone_trajectory[i].x - duck_trajectory[i].x);
            closest_encounter.second = i;
        }
    }
}
Beispiel #5
0
void Board::back(Step* step)
{
    reliveStone(step->_killid);
    moveStone(step->_moveid, step->_rowFrom, step->_colFrom);
}