public string Points( int week) { var(rushingTouchdowns, runningBackSet) = TouchdownsForRushing(week); rushingTouchdowns += QbTouchdownsForRushing(week); var(passingTouchdowns, quarterback) = TouchdownsForPassing(week); var(receivingTouchdowns, receiverSet) = TouchdownsForReceiving(week); var(rbReceivingTouchdowns, catchingRbSet) = RbTouchdownsForReceiving(week); receivingTouchdowns += rbReceivingTouchdowns; if (receivingTouchdowns > 0 && runningBackSet.Count() < 2) { runningBackSet.Add( catchingRbSet.At(0)); } var(fgs, pats, kicker) = Kicking(week); var tdp = MinOf(passingTouchdowns, receivingTouchdowns); var openReceivers = receivingTouchdowns > passingTouchdowns ? receivingTouchdowns - passingTouchdowns : 0; AllocateCatches(receiverSet, tdp); var tds = rushingTouchdowns + tdp; var xp = MinOf(pats, tds); var points = (tds * 6) + (fgs * 3) + xp; TotalPoints += points; GameScore[week] = points; LineUp[week].QB = quarterback; LineUp[week].RB1 = runningBackSet.At(0); LineUp[week].RB2 = runningBackSet.At(1); LineUp[week].PR1 = receiverSet.At(0); LineUp[week].PR2 = receiverSet.At(1); LineUp[week].PR3 = receiverSet.At(2); LineUp[week].Kicker = kicker; Contribution.Add(LineUp[week]); return($@" ({points,2}) TDp:{ tdp } TDr:{ rushingTouchdowns,2 } TDs:{ tds,2 } FGs:{ fgs,2 } xp:{ xp,2 } {Environment.NewLine} drops: { DroppedPasses( passingTouchdowns, receivingTouchdowns),2 } open recvrs: {openReceivers} rb spots avail: { 2-runningBackSet.Scorers(),2 }" ); }
public void Add(Contribution contrib, double res) { var contributions = Contribution.SingleOrDefault(c => c.Name == contrib.Name); if (contributions == null) { Contribution.Add(contrib); Contrib.Add(contrib, res); Save(); } else { Contrib.Add(contributions, res); Save(); } }