public SkystoneScoreDetail CalculateBreakdown() // see SkystoneScores.java
        {
            scoredPoints  = 0;
            penaltyPoints = 5 * minor + 20 * major;
            autoDelivered = 0;

            long i;

            for (i = 0; i < autoStones.Length; ++i)
            {
                if (autoStones[i] > 0)
                {
                    ++autoDelivered;
                }
            }

            i = autoDelivered - Math.Max(0, autoReturned);
            long targetReturned             = autoReturned > 0 && firstBrickReturned > 0 ? 1 : 0;
            long targets                    = (autoStones[0] == 2 ? 1 : 0) + (autoStones[1] == 2 ? 1 : 0);
            long navigated                  = Math.Max(0, navigated1) + Math.Max(0, navigated2);
            long teleopDeliveredNet         = Math.Max(0, teleopDelivered) - Math.Max(0, teleopReturned);
            long parked                     = Math.Max(0, parked1) + Math.Max(0, parked2);
            long capstones                  = (capstone1 > -1 ? 1 : 0) + (capstone2 > -1 ? 1 : 0);
            long capstoneHeight             = (capstone1 > -1 ? capstone1 : 0) + (capstone2 > -1 ? capstone2 : 0);
            SkystoneScoreDetail scoreDetail = new SkystoneScoreDetail();

            scoreDetail.totalPenaltyPoints = penaltyPoints;
            scoreDetail.minorPenalties     = minor;
            scoreDetail.majorPenalties     = major;
            scoredPoints            += scoreDetail.autoTransport = 2 * i - targetReturned * 8 + 8 * targets;
            scoredPoints            += scoreDetail.autoPlaced = 4 * Math.Max(0, autoPlaced);
            scoredPoints            += scoreDetail.navigated = 5 * navigated;
            scoredPoints            += scoreDetail.repositioned = 10 * Math.Max(0, repositioned);
            autonomousPoints         = scoredPoints;
            scoredPoints            += scoreDetail.teleopTransport = 1 * teleopDeliveredNet;
            scoredPoints            += scoreDetail.teleopPlaced = 1 * Math.Max(0, teleopPlaced);
            scoredPoints            += scoreDetail.towerBonus = 2 * Math.Max(0, tallestTower);
            teleopPoints             = scoredPoints - autonomousPoints;
            teleopToSubtractFromAuto = scoreDetail.teleopPlaced;
            scoredPoints            += scoreDetail.capstone = 5 * capstones + 1 * capstoneHeight;
            scoredPoints            += scoreDetail.foundationMoved = 15 * Math.Max(0, foundationMoved);
            scoredPoints            += scoreDetail.parked = 5 * parked;
            endGamePoints            = scoredPoints - autonomousPoints - teleopPoints;
            if (Match.MatchType == TMatchType.ELIMS && card1 >= 2)
            {
                scoredPoints = adjust;
            }
            scoreDetail.totalScore = scoredPoints;
            return(scoreDetail);
        }
Esempio n. 2
0
        public FMSSkystoneScoreDetail(SkystoneScores score, long penaltyPoints)
        {
            autoStones = new Stone[score.autoStones.Length];

            for (long i = 0; i < score.autoStones.Length; ++i)
            {
                autoStones[i] = score.autoStones[i] == 2 ? Stone.SKYSTONE : score.autoStones[i] == 1 ? Stone.STONE : Stone.NONE;
            }

            autoDelivered             = score.autoDelivered;
            autoPlaced                = score.autoPlaced;
            autoReturned              = score.autoReturned;
            foundationRepositioned    = score.repositioned == 1;
            robot1.navigated          = score.navigated1 == 1;
            robot2.navigated          = score.navigated2 == 1;
            firstReturnedIsSkystone   = score.firstBrickReturned == 1;
            driverControlledDelivered = score.teleopDelivered;
            driverControlledReturned  = score.teleopReturned;
            driverControlledPlaced    = score.teleopPlaced;
            tallestSkyscraper         = score.tallestTower;
            robot1.capstoneLevel      = score.capstone1;
            robot2.capstoneLevel      = score.capstone2;
            foundationMoved           = score.foundationMoved == 1;
            robot1.parked             = score.parked1 == 1;
            robot2.parked             = score.parked2 == 1;
            minorPenalties            = score.minor;
            majorPenalties            = score.major;
            SkystoneScoreDetail detail = score.CalculateBreakdown();

            autoDeliveryPoints             = detail.autoTransport;
            autoPlacedPoints               = detail.autoPlaced;
            repositionedPoints             = detail.repositioned;
            navigationPoints               = detail.navigated;
            driverControlledDeliveryPoints = detail.teleopTransport;
            driverControlledPlacedPoints   = detail.teleopPlaced;
            skyscraperBonusPoints          = detail.towerBonus;
            capstonePoints         = detail.capstone;
            parkingPoints          = detail.parked;
            this.penaltyPoints     = penaltyPoints;
            totalPoints            = Math.Max(detail.totalScore + penaltyPoints, 0);
            endGamePoints          = score.EndGamePoints;
            autonomousPoints       = score.AutonomousPoints;
            driverControlledPoints = score.TeleopPoints;
        }