<commit_before>#
# doom_env.py, doom-net
#
# Created by <NAME> on 01/21/17.
#
import numpy as np
from vizdoom import *
from doom_instance import DoomInstance
from doom_instance_cig import DoomInstanceCig
from doom_instance_map import DoomInstanceMap


def init_doom_env(args):
    if args.action_set == 'noset':
        args.action_set = []
    elif args.action_set is not None:
        args.action_set = np.load(args.action_set).tolist()

    instance_class = {
        'basic': DoomInstance,
        'cig': DoomInstanceCig,
        'map': DoomInstanceMap
    }
    args.instance_class = instance_class[args.doom_instance]

    doom = args.instance_class(
        args.vizdoom_config,
        wad=args.wad_path,
        skiprate=args.skiprate,
        visible=False,
        mode=Mode.PLAYER,
        actions=args.action_set)
    state = doom.get_state_normalized()

    args.button_num = doom.get_button_num()
    args.screen_size = state.screen.shape
    args.variable_num = len(state.variables)
    if state.variables is not None:
        args.variables_size = state.variables.shape<commit_msg>fixing missing reference<commit_after>#
# doom_env.py, doom-net
#
# Created by <NAME> on 01/21/17.
#
import numpy as np
from vizdoom import *
from doom_instance import DoomInstance
from doom_instance_cig import DoomInstanceCig


def init_doom_env(args):
    if args.action_set == 'noset':
        args.action_set = []
    elif args.action_set is not None:
        args.action_set = np.load(args.action_set).tolist()

    instance_class = {
        'basic': DoomInstance,
        'cig': DoomInstanceCig
    }
    try:
        args.doom_instance
    except NameError:
        args.doom_instance = 'basic'
    args.instance_class = instance_class[args.doom_instance]

    doom = args.instance_class(
        args.vizdoom_config,
        wad=args.wad_path,
        skiprate=args.skiprate,
        visible=False,
        mode=Mode.PLAYER,
        actions=args.action_set)
    state = doom.get_state_normalized()

    args.button_num = doom.get_button_num()
    args.screen_size = state.screen.shape
    args.variable_num = len(state.variables)
    if state.variables is not None:
        args.variables_size = state.variables.shape
{'fraction_non_alphanumeric': 0.09397482014388489, 'fraction_numerical': 0.00539568345323741, 'mean_word_length': 3.0017985611510793, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5647974', 'n_tokens_mistral': 761, 'n_tokens_neox': 725, 'n_words': 145}