private int GuessFGs(NFLGame game) { int nFg = 1; string opponent = (TeamCode == game.HomeTeam) ? game.AwayTeam : game.HomeTeam; // Also load in the FGs allowed by the defensive team ArrayList fgAllowedList = GetFGallowed(opponent); ArrayList totalFGlist = JoinLists(fgAllowedList, _fgResultList); int nStats = totalFGlist.Count; if (nStats > 0) { RandomNumber myRandom = new RandomNumber(); // Generate a random number nFg = GuessFg(_fgResultList, nStats, myRandom); if (nFg > 0) if (game.IsBadWeather()) nFg--; if (game.IsDomeGame()) nFg++; //if ( game.HomeTeam == this.TeamCode ) nFG++; } return nFg; }
private static int GuessFg(IList fgResList, int nStats, RandomNumber myRandom) { int nRandom = myRandom.GetNumberInRange(0, nStats - 1); FieldGoalResult res = (FieldGoalResult)fgResList[nRandom]; return res.FgCount; }