Get age the game was won in.
160637
def _won_in(self):
        """"""
        if not self._summary['finished']:
            return
        starting_age = self._summary['settings']['starting_age'].lower()
        if starting_age == 'post imperial':
            starting_age = 'imperial'
        ages_reached = set([starting_age])
        for player in self._summary['players']:
            for age, reached in player['ages'].items():
                if reached:
                    ages_reached.add(age)
        ages = ['imperial', 'castle', 'feudal', 'dark']
        for age in ages:
            if age in ages_reached:
                return age
97511
def winning_abbr(self):
        
        if self.winner == HOME:
            if 'cfb/schools' not in str(self._home_name):
                return self._home_name.text()
            return utils._parse_abbreviation(self._home_name)
        if 'cfb/schools' not in str(self._away_name):
            return self._away_name.text()
        return utils._parse_abbreviation(self._away_name)
753606
def playerSurrendered(cfg):
    """"""
    if cfg.numAgents + cfg.numBots == 2:
          otherResult = c.RESULT_VICTORY
    else: otherResult = c.RESULT_UNDECIDED # if multiple players remain, they need to finish the match
    return assignValue(cfg, c.RESULT_DEFEAT, otherResult)
222397
def current_game(self):
        
        obj = self._prof
        gameid = obj.get("gameid")
        gameserverip = obj.get("gameserverip")
        gameextrainfo = obj.get("gameextrainfo")
        return (int(gameid) if gameid else None, gameserverip, gameextrainfo)
935139
def get_game_high_scores(self, *args, **kwargs):
        """"""
        return get_game_high_scores(*args, **self._merge_overrides(**kwargs)).run()
941707
def get_box_score(game_id):
    """"""
    year, month, day = get_date_from_game_id(game_id)
    try:
        return urlopen(GAME_URL.format(year, month, day, game_id,
                                       'boxscore.xml'))
    except HTTPError:
        raise ValueError('Could not find a game with that id.')
106638
def age_range(self):
        """"""
        if self.date_range is None:
            return None, None
        start_date = DateRange(self.date_range.start, self.date_range.start)
        end_date = DateRange(self.date_range.end, self.date_range.end)
        start_age = DOB(date_range=end_date).age
        end_age = DOB(date_range=start_date).age
        return start_age, end_age
1364839
def get_playcount(self):
        """"""

        doc = self._request(self.ws_prefix + ".getInfo", True)

        return _number(_extract(doc, "playcount"))
577887
def age(self):
        """"""
        if self.Death:
            age =  self.Death - self.Born
        else:    
            age =  datetime.date.today() - self.Born
        return age.days
382698
function() {
      var turnText = (game.turn === game.team) ? 'Your Turn' : 'Their Turn';
      var turnColor = (game.turn === game.team) ? '#C8FFCD' : '#DDD';
      document.getElementById('turn').innerText = turnText;
      document.getElementsByTagName('body')[0].style.background = turnColor;
    }
634599
def whoAmI(self):
        """"""
        self.inflate() # ensure self.players contains player objects
        if self.thePlayer:
            for p in self.players:
                if p.name != self.thePlayer: continue
                return p
        elif len(self.players) == 1:
            ret = self.players[0]
            self.thePlayer = ret.name # remember this for the future in case more players are added
            return ret
        raise Exception("could not identify which player this is given %s (%s)"%(self.players, self.thePlayer))
75439
def length(self):
        """"""
        return sum([shot.length for shot in self.shots if not shot.is_splay])
243851
def play_by_play(
        game_id,
        start_period=0,
        end_period=0
    )
      NbaStats::Resources::PlayByPlay.new(
          get(PLAY_BY_PLAY_PATH, {
              :GameID => game_id,
              :StartPeriod => start_period,
              :EndPeriod => end_period
          })
      )
    end
743669
def is_won(grid):
    ""
    p, q = grid
    return any(way == (way & q) for way in ways_to_win)
295028
def age(self, **kwargs):
        
        if kwargs.get('days', None) is not None:
            self._age += kwargs.get('days')
            return
        if kwargs.get('hours', None) is not None:
            self._age += kwargs.get('hours') / 24.
            return
        if kwargs.get('minutes', None) is not None:
            self._age += kwargs.get('minutes') / 24. / 60.
            return
        if kwargs.get('seconds', None) is not None:
            self._age += kwargs.get('seconds') / 24. / 60. / 60.
            return

        raise KeyError("Could not age particle, please specify 'days', 'hours', 'minutes', or 'seconds' parameter")
1340834
def nice_output(self):
        """"""
        dates = [
            str_format('Opening Day {0}: {1}.',
                       [self.year, date_format(self.first_date_seas)]),
            str_format('Last day of the 1st half: {0}.',
                       [date_format(self.last_date_1sth)]),
            str_format('{0} All Star Game: {1}.',
                       [self.year, date_format(self.all_star_date)]),
            str_format('First day of the 2nd half: {}.',
                       [date_format(self.first_date_2ndh)]),
            str_format('Last day of the {0} season: {1}.',
                       [self.year, date_format(self.last_date_seas)]),
            str_format('{0} Playoffs start: {1}.',
                       [self.year, date_format(self.playoffs_start_date)]),
            str_format('{0} Playoffs end: {1}.',
                       [self.year, date_format(self.playoffs_end_date)])
        ]
        return '\n'.join(dates)
752653
def check_if_win(self):
        """"""
        self.flagcount = 0
        win = True
        for x in range(0, len(self.mine_matrix[0])):
            for y in range(0, len(self.mine_matrix)):
                if self.mine_matrix[y][x].state == 1:
                    self.flagcount += 1
                    if not self.mine_matrix[y][x].has_mine:
                        win = False
                elif self.mine_matrix[y][x].has_mine:
                    win = False
        self.lblMineCount.set_text("%s" % self.minecount)
        self.lblFlagCount.set_text("%s" % self.flagcount)
        if win:
            self.dialog = gui.GenericDialog(title='You Win!', message='Game done in %s seconds' % self.time_count)
            self.dialog.confirm_dialog.do(self.new_game)
            self.dialog.cancel_dialog.do(self.new_game)
            self.dialog.show(self)