Esempio n. 1
0
        private void EvaluateRo( GameStats game, UnitMatrix offMatrix, UnitMatrix defMatrix, bool bHome )
        {
            decimal avgMetric = AverageMetric( ( Total.AwayTDruns + Total.HomeTDruns )/2 );
            //			RosterLib.Utility.Announce( string.Format( "League Average Tdr is {0:###.#} (tot={1:###.#})",
            //				avgMetric, Total.AwayTDruns + Total.HomeTDruns ) );

            decimal gp = offMatrix.GamesPlayed;
            decimal tdr = offMatrix.RoMetrics;
            decimal offMult = Multiplier( tdr/gp, avgMetric );
            decimal defMult = Multiplier( avgMetric, defMatrix.RdMetrics/defMatrix.GamesPlayed );

            //			RosterLib.Utility.Announce( string.Format( "Offense {1} averages {0:###.#} Tdr/game",
            //				offMatrix.ROMetrics / offMatrix.GamesPlayed, offMatrix.TeamCode ) );
            //			RosterLib.Utility.Announce( string.Format( "Defence {1} averages {0:###.#} Tdr allowed/game",
            //				defMatrix.RDMetrics / defMatrix.GamesPlayed, defMatrix.TeamCode ) );

            decimal metric = ( bHome ) ? game.HomeTDruns : game.AwayTDruns;
            //string result = ResultOf( metric, 100.0M, 125.0M );
            string result = ResultOf( metric, 0.0M, 1.0M );
            //			RosterLib.Utility.Announce( "Result=" + result );

            decimal offPoints;
            decimal defPoints;

            switch ( result )
            {
                case "L":
                    offPoints = KPointsLoss;
                    defPoints = KPointsWin;
                    break;
                case "D":
                    offPoints = KPointsDraw;
                    defPoints = KPointsDraw;
                    break;
                default:
                    offPoints = KPointsWin;
                    defPoints = KPointsLoss;
                    break;
            }

            offMatrix.AddRoPoints( offPoints, defMult, game );
            defMatrix.AddRdPoints( defPoints, offMult, game );
            DistributeEp( "RO", offPoints, defMult, game, bHome );
            DistributeEp( "RD", defPoints, offMult, game, bHome );
            Explain( offMatrix, defMatrix, "Rush Offence", offPoints,
                        defPoints, "RO", "RD", offMult, defMult, result,
                        ( offMatrix.RoPoints - offPoints ), ( defMatrix.RdPoints - defPoints ), metric, bHome );
        }