Create and register problems for the game.

  Args:
    game_name: str, one of the games in ATARI_GAMES, e.g. "bank_heist".
    game_mode: the frame skip and sticky keys config.

  Raises:
    ValueError: if game_name or game_mode are wrong.
967062
def register_game(game_name, game_mode="NoFrameskip-v4"):
  
  if game_name not in ATARI_GAMES:
    raise ValueError("Game %s not in ATARI_GAMES" % game_name)
  if game_mode not in ATARI_GAME_MODES:
    raise ValueError("Unknown ATARI game mode: %s." % game_mode)
  camel_game_name = misc_utils.snakecase_to_camelcase(game_name) + game_mode
  # Create and register the Problem
  cls = type("Gym%sRandom" % camel_game_name,
             (T2TGymEnv,), {"base_env_name": camel_game_name})
  registry.register_problem(cls)
285793
def send_game(self, *args, **kwargs):
        """"""
        return send_game(*args, **self._merge_overrides(**kwargs)).run()
1150755
def check_name_collision( self, name, block_id, checked_ops ):
        

        return self.check_collision( "name", name, block_id, checked_ops, OPCODE_NAME_STATE_CREATIONS )
308992
def _valid_table_name(self, table_name):
        
        if table_name is None or not len(table_name.strip()):
            raise ValueError("Invalid table name: %r" % table_name)
        return table_name.strip()
653665
def sendGame(self, chat_id, game_short_name,
                 disable_notification=None,
                 reply_to_message_id=None,
                 reply_markup=None):
        
        p = _strip(locals())
        return self._api_request('sendGame', _rectify(p))
1340801
def word_game_round(self, message):
        ""

        letter = random.choice(string.ascii_uppercase)
        topics = []

        while len(topics) < 10:
            new_topic = random.choice(WORD_GAME_TOPICS)
            if new_topic not in topics:
                topics.append({
                    "index": len(topics) + 1,
                    "topic": new_topic
                })

        context = {
            "letter": letter,
            "topics": topics
        }
        self.say(rendered_template("word_game.html", context), message=message)
1136172
function GameMsg(gm) {
        gm = gm || {};

        /**
         * ### GameMsg.id
         *
         * A randomly generated unique id
         */
        this.id = 'undefined' === typeof gm.id ?
            Math.floor(Math.random()*1000000) : gm.id;

        /**
         * ### GameMsg.sid
         *
         * The socket id, if provided
         *
         * Used by SocketIO to prevent spoofing, not used by other sockets
         * TODO: could this be session instead?
         */
        this.sid = gm.sid;

        /**
         * ### GameMsg.session
         *
         * The session id in which the message was generated
         */
        this.session = gm.session;

        /**
         * ### GameMsg.stage
         *
         * The game-stage in which the message was generated
         *
         * @see GameStage
         */
        this.stage = gm.stage;

        /**
         * ### GameMsg.action
         *
         * The action of the message
         *
         * @see node.constants.action
         */
        this.action = gm.action;

        /**
         * ### GameMsg.target
         *
         * The target of the message
         *
         * @see node.constants.target
         */
        this.target = gm.target;

        /**
         * ### GameMsg.from
         *
         * The id of the sender of the message
         *
         * @see Player.id
         * @see node.player.id
         */
        this.from = gm.from;

        /**
         * ### GameMsg.to
         *
         * The id of the receiver of the message
         *
         * @see Player.id
         * @see node.player.id
         */
        this.to = gm.to;

        /**
         * ### GameMsg.text
         *
         * An optional text adding a description for the message
         */
        this.text = gm.text;

        /**
         * ### GameMsg.data
         *
         * An optional payload field for the message
         */
        this.data = gm.data;

        /**
         * ### GameMsg.priority
         *
         * A priority index associated to the message
         */
        this.priority = gm.priority;

        /**
         * ### GameMsg.reliable
         *
         * Experimental. Disabled for the moment
         *
         * If set, requires ackwnoledgment of delivery
         */
        this.reliable = gm.reliable;

        /**
         * ### GameMsg.created
         *
         * A timestamp of the date of creation
         */
        this.created = J.getDate();

        /**
         * ### GameMsg.forward
         *
         * If TRUE, the message is a forward.
         *
         * E.g. between nodeGame servers
         */
        this.forward = 0;
    }
428697
def read_games(glob, existing_paths):
    

    globbed = sorted(gfile.Glob(glob))

    skipped = 0
    to_parse = []
    for sgf_name in tqdm(globbed):
        assert sgf_name.lower().endswith('.sgf'), sgf_name
        sgf_path = canonical_name(sgf_name)
        sgf_filename = os.path.basename(sgf_path)

        if sgf_path in existing_paths or sgf_filename in existing_paths:
            skipped += 1
            continue

        to_parse.append(sgf_name)

    game_data = []
    with multiprocessing.Pool() as pool:
        game_data = pool.map(process_game, tqdm(to_parse), 100)

    print("Read {} SGFs, {} new, {} existing".format(
        len(globbed), len(game_data), skipped))
    return game_data
767497
def add_to_ignore_list_if_challenge_is_incomplete(rule)
      return unless auto_correct_incomplete?(rule)

      pull_request.commit! ':police_car: add the rule to the ignore list' do
        config_editor = Rubocop::ConfigEditor.new
        config_editor.add_ignore(rule)
        config_editor.save
      end
      color_puts DESCRIPTION_THAT_CHALLENGE_IS_INCOMPLETE,
                 PrComet::CommandLine::YELLOW
    end
423830
def play(self, target=None, index=None, choose=None):
		
		if choose:
			if self.must_choose_one:
				choose = card = self.choose_cards.filter(id=choose)[0]
				self.log("%r: choosing %r", self, choose)
			else:
				raise InvalidAction("%r cannot be played with choice %r" % (self, choose))
		else:
			if self.must_choose_one:
				raise InvalidAction("%r requires a choice (one of %r)" % (self, self.choose_cards))
			card = self
		if not self.is_playable():
			raise InvalidAction("%r isn't playable." % (self))
		if card.requires_target():
			if not target:
				raise InvalidAction("%r requires a target to play." % (self))
			elif target not in self.play_targets:
				raise InvalidAction("%r is not a valid target for %r." % (target, self))
		elif target:
			self.logger.warning("%r does not require a target, ignoring target %r", self, target)
		self.game.play_card(self, target, index, choose)
		return self
1040516
def fight(self, moves, print_console):
        
        for _ in range(1, moves):
            #if i == 1 and random.randint(1,100) > 50:   # randomly choose who moves first
            # player 1
            result, dmg = self.calc_move(self.c1)
            self.show_message(self.c1, self.c2, result, dmg, print_console)
            self.take_damage(self.c2, dmg)
            if self.is_character_dead(self.c2):
                #print(self.c2.name + ' has died')
                return self.c1.name
                
            # player 2
            result, dmg = self.calc_move(self.c2)
            self.show_message(self.c2, self.c1, result, dmg, print_console)
            self.take_damage(self.c1, dmg)
            if self.is_character_dead(self.c1):
                #print(self.c1.name + ' has died')
                return self.c2.name
1293261
def set(self, names):
        
        return self._problem.set((self, name) for name in names)
1160019
def update_match_settings(self):
        
        self.mode_type_combobox.setCurrentText(self.overall_config.get(MATCH_CONFIGURATION_HEADER, GAME_MODE))
        self.map_type_combobox.setCurrentText(self.overall_config.get(MATCH_CONFIGURATION_HEADER, GAME_MAP))
        self.skip_replays_checkbox.setChecked(self.overall_config.getboolean(MATCH_CONFIGURATION_HEADER, SKIP_REPLAYS))
        self.instant_start_checkbox.setChecked(
            self.overall_config.getboolean(MATCH_CONFIGURATION_HEADER, INSTANT_START))
127462
def parseOneGame(self):
		
		if self.index < self.datalen:
			match = self.reGameTreeStart.match(self.data, self.index)
			if match:
				self.index = match.end()
				return self.parseGameTree()
		return None
618942
def _method_call(self, method, category, **kwargs):
        
        session = requests.Session()
        try:
            response = session.get("http://" + self._api_address)
        except requests.exceptions.ConnectionError:
            raise FantasyDataError('Error: Cannot connect to the FantasyData API')

        method = method.format(format=self._response_format, **kwargs)
        request_url = "/v3/{game_type}/{category}/{format}/{method}?{get_params}".format(
            game_type=self.game_type,
            category=category,
            format=self._response_format,
            method=method,
            get_params=self._get_params)
        response = session.get(self._api_schema + self._api_address + request_url,
                               headers=self._headers)
        result = response.json()

        if isinstance(result, dict) and response.status_code:
            if response.status_code == 401:
                raise FantasyDataError('Error: Invalid API key')
            elif response.status_code == 200:
                # for NBA everything is ok here.
                pass
            else:
                raise FantasyDataError('Error: Failed to get response')

        return result
1011540
def variation_name=(variation_name)

      if !variation_name.nil? && variation_name.to_s.length > 255
        fail ArgumentError, "invalid value for 'variation_name', the character length must be smaller than or equal to 255."
      end

      @variation_name = variation_name
    end
46639
def break_name(self, break_name):
        

        if break_name is None:
            raise ValueError("Invalid value for `break_name`, must not be `None`")
        if len(break_name) < 1:
            raise ValueError("Invalid value for `break_name`, length must be greater than or equal to `1`")

        self._break_name = break_name