Game Type Enumeration.
347609
def GameTypeEnum(ctx):
    """"""
    return Enum(
        ctx,
        RM=0,
        Regicide=1,
        DM=2,
        Scenario=3,
        Campaign=4,
        KingOfTheHill=5,
        WonderRace=6,
        DefendTheWonder=7,
        TurboRandom=8
    )
407714
private synchronized void enumerate(Hashtable h) {
        if (defaults != null) {
            defaults.enumerate(h);
        }
        for (Enumeration e = keys() ; e.hasMoreElements() ;) {
            String key = (String)e.nextElement();
            h.put(key, get(key));
        }
    }
1208179
def players(self, postgame, game_type):
        """"""
        for i, attributes in self._players():
            yield self._parse_player(i, attributes, postgame, game_type)
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
938550
private void calcNumWords() {
        if (numWordsCalculated) {
            return;
        }

        int words = 0;

        // The number of words reachable from this node is considered to be the number of words
        // reachable from it's children, and +1 if the node itself is a word.
        if (value.isPresent()) {
            words++;
        }

        for (TrieNode<T> child : children.values()) {
            child.calcNumWords();
            words += child.numWords;
        }

        numWords = words;
        numWordsCalculated = true;
    }
931970
def get_strategy_types():
    """"""
    def get_subtypes(type_):
        subtypes = type_.__subclasses__()
        for subtype in subtypes:
            subtypes.extend(get_subtypes(subtype))
        return subtypes
    return get_subtypes(Strategy)
911118
def conditions(self):
        """"""
        for idx in six.moves.range(1, len(self.children), 2):
            yield (self.children[idx - 1], self.children[idx])
126221
def games(self, platform):
        
        platform = platform.lower()
        data_list = self.db.get_data(self.games_path, platform=platform)
        data_list = data_list.get('Data') or {}
        return [Game(self.db.game, **i) for i in data_list.get('Game') or {}]
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);
    }
1178106
def operations(self, op_types=None):
        """"""
        if not op_types:
            op_types = ['message', 'action', 'sync', 'viewlock', 'savedchapter']
        while self._handle.tell() < self._eof:
            current_time = mgz.util.convert_to_timestamp(self._time / 1000)
            try:
                operation = mgz.body.operation.parse_stream(self._handle)
            except (ConstructError, ValueError):
                raise MgzError('failed to parse body operation')
            if operation.type == 'action':
                if operation.action.type in ACTIONS_WITH_PLAYER_ID:
                    counter = self._actions_by_player[operation.action.player_id]
                    counter.update([operation.action.type])
                else:
                    self._actions_without_player.update([operation.action.type])
            if operation.type == 'action' and isinstance(operation.action.type, int):
                print(operation.action)
            if operation.type == 'sync':
                self._time += operation.time_increment
            if operation.type == 'action' and operation.action.type == 'postgame':
                self._postgame = operation
            if operation.type == 'action':
                action = Action(operation, current_time)
                self._parse_action(action, current_time)
            if operation.type == 'savedchapter':
                # fix: Don't load messages we already saw in header or prev saved chapters
                self._parse_lobby_chat(operation.lobby.messages, 'save', current_time)
            if operation.type == 'viewlock':
                if operation.type in op_types:
                    yield Viewlock(operation)
            elif operation.type == 'action' and operation.action.type != 'postgame':
                if operation.type in op_types:
                    yield Action(operation, current_time)
            elif ((operation.type == 'message' or operation.type == 'embedded')
                  and operation.subtype == 'chat'):
                chat = ChatMessage(operation.data.text, current_time,
                                   self._players(), self._diplomacy['type'], 'game')
                self._parse_chat(chat)
                if operation.type in op_types:
                    yield chat
773687
def _num_players(self):
        """"""
        self._player_num = 0
        self._computer_num = 0
        for player in self._header.scenario.game_settings.player_info:
            if player.type == 'human':
                self._player_num += 1
            elif player.type == 'computer':
                self._computer_num += 1
709310
function Game(name) {
    this.name = name;
    this.board = [];  // list representation
    this.boardmat = [];  // matrix representation
    for (var i=0; i<181; i++) {
        this.boardmat[i] = new Array(181);
    }
    this.players = {};
    this.turn_pieces = [];  // pieces played this turn
    this.chat = [];  // chat log

    // board dimensions
    this.dimensions = {'top': 90, 'right': 90, 'bottom': 90, 'left': 90};

    /* Keep track of the pieces by having a list of piece objects each with a
     * count attribute that tracks how many of that piece are left. When this
     * reaches 0, we remove the piece object from the list.
     */
    this.pieces = [];
    var colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple'];
    var shapes =  ['circle', 'star', 'diamond', 'square', 'triangle', 'clover'];
    for (var c in colors) {
        if (!colors.hasOwnProperty(c)) {
            continue;
        }
        for (var s in shapes) {
            if (!shapes.hasOwnProperty(s)) {
                continue;
            }
            this.pieces.push({'piece': new Piece(shapes[s], colors[c]), 'count': 3});
        }
    }
}
1274713
def game(self):
        
        if isinstance(self.media, types.MessageMediaGame):
            return self.media.game
1126268
def get_squares(self, player=None):
        """"""
        if player:
            return [k for k, v in enumerate(self.squares) if v == player]
        else:
            return self.squares
468859
def bota_gorda(game):
    '''
    
    '''
    game.valid_moves = tuple(sorted(game.valid_moves, key=lambda m: -(m[0].first + m[0].second)))
1317592
public static <E> Enumeration<E> asEnumeration(Iterator<E> iter) {
		return new IteratorEnumeration<E>(iter);
	}
901541
function(gameId, relayServer, options) {
  options = options || {};
  this.options = options;
  this.gameId = gameId;
  this.relayServer = relayServer;
  this.games = [];  // first game is the "master"
  this.nextGameId = 0;  // start at 0 because it's easy to switch games with (gameNum + numGames + dir) % numGames
}