Skip to content

Instantly share code, notes, and snippets.

@akeaswaran
Last active November 8, 2019 23:54
Show Gist options
  • Select an option

  • Save akeaswaran/e04c493759ef6adf5d00227c4027f194 to your computer and use it in GitHub Desktop.

Select an option

Save akeaswaran/e04c493759ef6adf5d00227c4027f194 to your computer and use it in GitHub Desktop.

Revisions

  1. akeaswaran revised this gist Nov 16, 2017. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions pollscore.m
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,19 @@
    -(void)updateStrengthOfWins {
    int strWins = 0;
    for ( int i = 0; i < gameSchedule.count; ++i ) {
    Game *g = gameSchedule[i];
    if (g.homeTeam == self) {
    strWins += pow(60 - g.awayTeam.rankTeamPollScore,2);
    } else {
    strWins += pow(60 - g.homeTeam.rankTeamPollScore,2);
    }
    }
    teamStrengthOfWins = strWins/50;
    for (Team *t in gameWinsAgainst) {
    teamStrengthOfWins += pow(t.wins,2);
    }
    }

    -(void)updatePollScore {
    [self updateStrengthOfWins];
    int preseasonBias = 8 - (wins + losses);
  2. akeaswaran created this gist Nov 16, 2017.
    29 changes: 29 additions & 0 deletions pollscore.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    -(void)updatePollScore {
    [self updateStrengthOfWins];
    int preseasonBias = 8 - (wins + losses);
    if (preseasonBias < 0) preseasonBias = 0;
    teamPollScore = (wins*200 + 3*(teamPoints-teamOppPoints) + (teamYards-teamOppYards)/40 + (teamStrengthOfWins / 2) + 3*(preseasonBias)*(teamPrestige + [self getOffensiveTalent] + [self getDefensiveTalent]) + teamStrengthOfWins)/11 + (teamPrestige / 5);
    if ([@"CC" isEqualToString:confChampion] ) {
    //bonus for winning conference
    teamPollScore += 25;
    }
    if ( [@"NCW" isEqualToString:natlChampWL] ) {
    //bonus for winning champ game
    teamPollScore += 100;
    }
    if ( [@"NCL" isEqualToString:natlChampWL] ) {
    //bonus for winning champ game
    teamPollScore += 15;
    }
    if (losses == 0) {
    teamPollScore += 30;
    } else if (losses == 1 ) {
    teamPollScore += 15;
    } else {
    teamPollScore += 0;
    }

    if (teamPollScore < 0) {
    teamPollScore = 0;
    }
    }