player
 team
 game
 atbat
 pitch
 pitch type
 game type
 umpire
506631
def import_team_for_month(team_abbrev, year, month)
      start_date = Date.new(year.to_i, month.to_i) # first day of month
      end_date = (start_date >> 1)-1 # last day of month
      ((start_date)..(end_date)).each do |dt| 
        puts year.to_s + '/' + month.to_s + '/' + dt.day
        team = Team.new('det')
        games = team.games_for_date(year, month, dt.day.to_s)
        games.each do |game|
          import_for_game(game.gid)
        end
      end
    end
121247
function Game() {

        // un-populated instance of Array2d
        this.map = new RL.Map(this);
        this.entityManager = new RL.ObjectManager(this, RL.Entity);
        this.renderer = new RL.Renderer(this);
        this.console = new RL.Console(this);
        this.lighting = new RL.LightingROT(this);

        // player purposefully not added to entity manager (matter of preference)
        this.player = new RL.Player(this);

        // make sure "this" is this instance of Game when this.onKeyAction is called
        this.onKeyAction = this.onKeyAction.bind(this);
        this.onClick = this.onClick.bind(this);
        this.onHover = this.onHover.bind(this);

        this.input = new RL.Input(this.onKeyAction);
        this.mouse = new RL.Mouse(this.onClick, this.onHover);

        var el = this.renderer.canvas;
        this.mouse.startListening(el);
    }
670738
function (playerCards, dealerCard, handValue, handCount, dealerCheckedBlackjack, options) 
    {
        // If exactComposition isn't set, no override
        if (options.strategyComplexity != "exactComposition")
        {
            return null;
        }

        // Now look at strategies based on game options
        if ((options.numberOfDecks == 2) && (!options.hitSoft17)) 
        {
            return TwoDeckStandSoft17(playerCards, dealerCard, handValue, handCount, dealerCheckedBlackjack, options);
        }
    }
372630
def _generate_game_object(cls, soup, timestamp, game_number):
        
        game = Game(timestamp)

        # Base Game Data(Spring Training, Regular Season, Play Off, etc...)
        game.game_type = MlbamUtil.get_attribute(soup.game, 'type', unknown=MlbamConst.UNKNOWN_SHORT)
        game.game_type_des = cls._get_game_type_des(game.game_type)
        game.st_fl = cls._get_st_fl(game.game_type)
        game.regseason_fl = cls._get_regseason_fl(game.game_type)
        game.playoff_fl = cls._get_playoff_fl(game.game_type)
        game.local_game_time = MlbamUtil.get_attribute(soup.game, 'local_game_time', unknown=MlbamConst.UNKNOWN_FULL)
        game.game_id = MlbamUtil.get_attribute(soup.game, 'game_pk', unknown=MlbamConst.UNKNOWN_FULL)

        # Team Data
        game.home_team_id = cls._get_team_attribute(soup, cls.TEAM_TYPE_HOME, 'code')
        game.home_team_lg = cls._get_team_attribute(soup, cls.TEAM_TYPE_HOME, 'league')
        game.away_team_id = cls._get_team_attribute(soup, cls.TEAM_TYPE_AWAY, 'code')
        game.away_team_lg = cls._get_team_attribute(soup, cls.TEAM_TYPE_AWAY, 'league')
        game.home_team_name = cls._get_team_attribute(soup, cls.TEAM_TYPE_HOME, 'name')
        game.away_team_name = cls._get_team_attribute(soup, cls.TEAM_TYPE_AWAY, 'name')
        game.home_team_name_full = cls._get_team_attribute(soup, cls.TEAM_TYPE_HOME, 'name_full')
        game.away_team_name_full = cls._get_team_attribute(soup, cls.TEAM_TYPE_AWAY, 'name_full')
        game.interleague_fl = cls._get_interleague_fl(game.home_team_lg, game.away_team_lg)

        # Stadium Data
        game.park_id = cls._get_stadium_attribute(soup, 'id')
        game.park_name = cls._get_stadium_attribute(soup, 'name')
        game.park_loc = cls._get_stadium_attribute(soup, 'location')

        # Retro ID
        game.retro_game_id = cls._get_retro_id(game.home_team_id, timestamp, game_number)

        return game
910929
def _get_game_type_des(cls, game_type):
        
        if game_type == 'S':
            return 'Spring Training'
        elif game_type == 'R':
            return 'Regular Season'
        elif game_type == 'F':
            return 'Wild-card Game'
        elif game_type == 'D':
            return 'Divisional Series'
        elif game_type == 'L':
            return 'LCS'
        elif game_type == 'W':
            return 'World Series'
        return MlbamConst.UNKNOWN_FULL
221086
def check_for_end_game(self):
		
		gameover = False
		for player in self.players:
			if player.playstate in (PlayState.CONCEDED, PlayState.DISCONNECTED):
				player.playstate = PlayState.LOSING
			if player.playstate == PlayState.LOSING:
				gameover = True

		if gameover:
			if self.players[0].playstate == self.players[1].playstate:
				for player in self.players:
					player.playstate = PlayState.TIED
			else:
				for player in self.players:
					if player.playstate == PlayState.LOSING:
						player.playstate = PlayState.LOST
					else:
						player.playstate = PlayState.WON
			self.state = State.COMPLETE
			self.manager.step(self.next_step, Step.FINAL_WRAPUP)
			self.manager.step(self.next_step, Step.FINAL_GAMEOVER)
			self.manager.step(self.next_step)
252854
def set_innings(element)
        element.elements.each("linescore/inning") { |element|
           @away_innings << element.attributes['away']
           @home_innings << element.attributes['home']
        }
      end
264464
def player_marks(grid):
    ""
    p, q = grid
    return 'XO' if sum(player_bits(p)) == sum(player_bits(q)) else 'OX'
1343712
function forcePlayerTeam($player, $team, $multicall = false)
    {
        $login = $this->getLogin($player);
        if ($login === false) {
            throw new InvalidArgumentException('player = ' . print_r($player, true));
        }
        if ($team !== 0 && $team !== 1) {
            throw new InvalidArgumentException('team = ' . print_r($team, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($login, $team), $multicall);
    }
158465
def by_player(self):
        """"""
        return any([k.player and self.name != k.name for k in self.killers])
295213
def _players(self):
        """"""
        for i in range(1, self._header.replay.num_players):
            yield i, self._header.initial.players[i].attributes
1135091
function onGetPlayers(pdata) {
    $(PLAYERS).empty();
    // display all players
    for (var p in pdata) {
        if (!pdata.hasOwnProperty(p)) {
            continue;
        }
        var turn = pdata[p].has_turn ? "has_turn" : "";
        $(PLAYERS).append("<dt class='" + turn + "'>" + esc(p) + "</dt>" +
                          "<dd>" + pdata[p].points + "</dd>");
    }

    var my_game = $.cookie("game");
    var my_player = $.cookie("player");
    if (my_player) {
        if (pdata[my_player] === undefined) {
            // I've got a player name, but we need to add it to the game
            $.post("/games/" + enc(my_game) + "/players", {name: my_player},
                   function() {getPlayers();});
        } else if (HAVETURN !== pdata[my_player].has_turn) {
            HAVETURN = pdata[my_player].has_turn;
            if (HAVETURN) {
                countdownTimer();
            } else {
                clearTimeout(COUNTDOWNTID);
            }
            drawTurnInfo(pdata);
        }
    }
}
518952
def set_pitchers(element)
      element.elements.each("winning_pitcher") do |wp|
        @winning_pitcher = Player.new
        @winning_pitcher.init_pitcher_from_scoreboard(wp)
      end
      element.elements.each("losing_pitcher") do |lp|
        @losing_pitcher = Player.new
        @losing_pitcher.init_pitcher_from_scoreboard(lp)
      end
      element.elements.each("save_pitcher") do |sp|
        @save_pitcher = Player.new
        @save_pitcher.first = sp.attributes['first']
        @save_pitcher.last = sp.attributes['last']
        @save_pitcher.saves = sp.attributes['saves']
      end
    end
167901
def is_pa_terminal(cls, ball_tally, strike_tally, pitch_res, event_cd):
        
        if RetroSheet.is_pa_terminal(ball_tally, strike_tally, pitch_res, event_cd):
            return MlbamConst.FLG_TRUE
        return MlbamConst.FLG_FALSE
195160
def player_skill(self, player_handle, game_mode='solo'):
        """"""
        if game_mode not in constants.GAME_MODES:
            raise APIException("game_mode must be one of: solo, duo, squad, all")
        try:
            data = self._get_player_profile(player_handle)
            player_stats = {}
            return_data = []
            for stat in data['Stats']:
                if stat['Match'] == game_mode:
                    for datas in stat['Stats']:
                        if datas['label'] == 'Rating':
                            player_stats[stat['Region']] = datas['value']
            return player_stats
        except BaseException as error:
            print('Unhandled exception: ' + str(error))
            raise
404537
def roster(team_id):
    """"""
    data = mlbgame.info.roster(team_id)
    return mlbgame.info.Roster(data)
1341772
function addPlayerToGame(game, playernm) {
    var p = new Player(playernm);
    p.pieces = game.drawPieces(6);
    game.players[p.name] = p;

    // if first player, make it his turn
    if (Object.keys(game.players).length === 1) {
        p.has_turn = true;
    }
}