コード例 #1
0
    public void SolveTopCrossMiddle(CubeModel[,,] fullCubeModel)
    {
        //find the middle white piece and move it to center top
        //it can only be in one of six spots

        CubeModel temp;

        temp = fullCubeModel [1, 1, 0];
        if (temp.GetTopColor().Equals(Color.white))
        {
            fullCubeController.IncreaseStage();
            return;
        }

        temp = fullCubeModel [1, 1, 2];
        if (temp.GetBottomColor().Equals(Color.white))
        {
            fullCubeController.AddAction(9);
            fullCubeController.AddAction(9);
            fullCubeController.IncreaseStage();
            return;
        }

        temp = fullCubeModel [1, 0, 1];
        if (temp.GetFrontColor().Equals(Color.white))
        {
            fullCubeController.AddAction(9);
            fullCubeController.IncreaseStage();
            return;
        }

        temp = fullCubeModel [1, 2, 1];
        if (temp.GetBackColor().Equals(Color.white))
        {
            fullCubeController.AddAction(8);
            fullCubeController.IncreaseStage();
            return;
        }

        temp = fullCubeModel [0, 1, 1];
        if (temp.GetLeftColor().Equals(Color.white))
        {
            fullCubeController.AddAction(14);
            fullCubeController.IncreaseStage();
            return;
        }

        temp = fullCubeModel [2, 1, 1];
        if (temp.GetRightColor().Equals(Color.white))
        {
            fullCubeController.AddAction(15);
            fullCubeController.IncreaseStage();
            return;
        }
    }