Пример #1
0
    int checkResult()
    {
        int leftPriests  = 0;
        int rightPriests = 0;
        int leftDemons   = 0;
        int rightDemons  = 0;

        int[] leftStatus = leftLand.getStatus();
        leftPriests += leftStatus[0];
        leftDemons  += leftStatus[1];

        if (leftPriests + leftDemons == 6)
        {
            return(2);
        }

        int[] rightStatus = rightLand.getStatus();
        rightPriests += rightStatus[0];
        rightDemons  += rightStatus[1];

        int[] boatStatus = boat.getBoatStatus();
        if (boat.getBoatPos() == 0)
        {
            leftPriests += boatStatus[0];
            leftDemons  += boatStatus[1];
        }
        else
        {
            rightPriests += boatStatus[0];
            rightDemons  += boatStatus[1];
        }

        if (leftPriests > 0 && leftPriests < leftDemons)
        {
            return(1);
        }
        if (rightPriests > 0 && rightPriests < rightDemons)
        {
            return(1);
        }

        return(0);
    }