/// <summary> /// Evaluates the Passing Offense and Defence, based on passing yards. /// </summary> /// <param name="game">The game.</param> /// <param name="offMatrix">The off Matrix.</param> /// <param name="defMatrix">The def Matrix.</param> /// <param name="bHome">if set to <c>true</c> [b home].</param> private void EvaluatePo( GameStats game, UnitMatrix offMatrix, UnitMatrix defMatrix, bool bHome ) { // What is the league average for Tdp var avgMetric = AverageMetric( ( Total.AwayTDpasses + Total.HomeTDpasses )/2 ); // How does the offence compare against the League var offMult = Multiplier( offMatrix.PoMetrics/offMatrix.GamesPlayed, avgMetric ); #if DEBUG Utility.Announce( string.Format( "League Average Tdp is {0:###.#} (tot={1:###.#})", avgMetric, Total.AwayTDpasses + Total.HomeTDpasses ) ); Utility.Announce( string.Format( "Defence {1} gives up an average of {0:###.#} Tdp/game", defMatrix.PpMetrics/defMatrix.GamesPlayed, defMatrix.TeamCode ) ); Utility.Announce( string.Format( "Offense {1} averages {0:###.#} Tdp/game", offMatrix.PoMetrics/offMatrix.GamesPlayed, offMatrix.TeamCode ) ); #endif var defMult = Multiplier( avgMetric, defMatrix.PdMetrics/defMatrix.GamesPlayed ); // Avg Def = 1.0 var metric = ( bHome ) ? game.HomeTDpasses : game.AwayTDpasses; decimal offPoints; decimal defPoints; var result = ResultOf( metric, 0.0M, 1.0M ); //Utility.Announce( string.Format( " WizSeason.EvaluatePO Result for {1} = {0}", result, offMatrix.Team.Name ) ); #region tally switch ( result ) { case "L": offPoints = KPointsLoss; defPoints = KPointsWin; break; case "D": offPoints = KPointsDraw; defPoints = KPointsDraw; break; default: offPoints = KPointsWin; defPoints = KPointsLoss; break; } offMatrix.AddPoPoints( offPoints, defMult, game ); defMatrix.AddPdPoints( defPoints, offMult, game ); // Give each member of the passing unit the experience too DistributeEp( "PO", offPoints, defMult, game, bHome ); DistributeEp( "PD", defPoints, offMult, game, bHome ); #endregion Explain( offMatrix, defMatrix, "Pass Offence", offPoints, defPoints, "PO", "PD", offMult, defMult, result, ( offMatrix.PoPoints - ( offPoints*defMult ) ), ( defMatrix.PdPoints - ( defPoints*offMult ) ), metric, bHome ); }