Exemplo n.º 1
0
def game_opts():
    games = {}
    opts = {}
    opts['featurizer'] = {}
    #    opts['featurizer']['abs_loc_vocab'] = True
    shared_static_opts = {}
    shared_static_opts['step_cost'] = -.1
    shared_static_opts['water_cost'] = -.2

    #####################################
    # goto:
    go_dict = {}
    for i in shared_static_opts:
        go_dict[i] = shared_static_opts[i]
    go_dict['fixed_goal'] = True
    go_dict['map_width'] = [5, 10, 5, 10, 1]
    go_dict['map_height'] = [5, 10, 5, 10, 1]
    go_dict['nblocks'] = [1, 5, 1, 5, 1]
    go_dict['nwater'] = [1, 5, 1, 5, 1]
    goto_opts = {
        'game_opts': gf.opts_from_dict(go_dict),
        'featurizer': opts['featurizer']
    }
    opts['goto'] = goto_opts
    games['goto'] = goto

    #####################################
    # switches:
    go_dict = {}
    for i in shared_static_opts:
        go_dict[i] = shared_static_opts[i]
    go_dict['map_width'] = [5, 10, 5, 10, 1]
    go_dict['map_height'] = [5, 10, 5, 10, 1]
    go_dict['nblocks'] = [1, 5, 1, 5, 1]
    go_dict['nwater'] = [1, 5, 1, 5, 1]
    go_dict['nswitches'] = [3, 5, 3, 5, 1]
    go_dict['ncolors'] = [3, 3, 3, 3, 0]

    switches_opts = {
        'game_opts': gf.opts_from_dict(go_dict),
        'featurizer': opts['featurizer']
    }
    opts['switches'] = switches_opts
    games['switches'] = switches

    ######################################
    #fixme:
    h = 0
    w = 0
    for g in opts:
        h = max(opts[g]['game_opts']['map_height'].max_possible(), h)
        w = max(opts[g]['game_opts']['map_width'].max_possible(), w)
    opts['featurizer']['max_map_sizes'] = (w, h)
    return game_opts, games
Exemplo n.º 2
0
def game_opts():
    #featurizer_class = GridFeaturizer
    featurizer_class = ObjFeaturizer
    games = {}
    opts = {}
    opts['featurizer'] = {}
    shared_static_opts = {}
    shared_static_opts['step_cost'] = -.1
    shared_static_opts['water_cost'] = -.2

    #####################################
    # goto:
    go_dict = {}
    for i in shared_static_opts:
        go_dict[i] = shared_static_opts[i]
    go_dict['fixed_goal'] = True
    go_dict['map_width'] = [5, 10, 1, 10, 1]
    go_dict['map_height'] = [5, 10, 1, 10, 1]
    go_dict['nblocks'] = [1, 1, 1, 5, 1]
    go_dict['nwater'] = [1, 1, 1, 5, 1]
    goto_opts = {'game_opts': gf.opts_from_dict(go_dict)}  #,
    #                'featurizer': opts['featurizer']}
    opts['goto'] = goto_opts
    games['goto'] = goto

    #fixme:
    h = opts['goto']['game_opts']['map_height'].max_possible()
    w = opts['goto']['game_opts']['map_width'].max_possible()
    opts['featurizer']['max_map_sizes'] = (w, h)

    return opts, games, featurizer_class
Exemplo n.º 3
0
def game_opts():
    featurizer_class = GridFeaturizer
    #featurizer_class = ObjFeaturizer
    games = {}
    opts = {}
    opts['featurizer'] = {}
    shared_static_opts = {}
    shared_static_opts['step_cost'] = -.05
    shared_static_opts['water_cost'] = -.2

    #####################################
    # switches:
    switch_dict = {}
    for i in shared_static_opts:
        switch_dict[i] = shared_static_opts[i]
    switch_dict['fixed_goal'] = True
    switch_dict['map_width'] = [5, 5, 5, 5, 0]
    switch_dict['map_height'] = [5, 5, 5, 5, 0]
    switch_dict['nblocks'] = [2, 2, 2, 2, 0]
    switch_dict['nwater'] = [1, 1, 1, 1, 0]
    switch_dict['nswitches'] = [2, 2, 2, 2, 0]
    switch_dict['ncolors'] = [2, 2, 2, 2, 0]

    switches_opts = {'game_opts': gf.opts_from_dict(switch_dict),
                'featurizer': opts['featurizer']}
    opts['switches'] = switches_opts
    games['switches'] = switches

    #fixme:
    h = opts['switches']['game_opts']['map_height'].max_possible()
    w = opts['switches']['game_opts']['map_width'].max_possible()
    opts['featurizer']['max_map_sizes'] = (w,h)

    return opts, games, featurizer_class
Exemplo n.º 4
0
def game_opts():
    featurizer_class = SparseSentenceFeaturizer
    games = {}
    opts = {}
    opts['featurizer'] = {'egocentric_coordinates':True, 
                               'separate_loc':False,
                               'visible_range':8 }
    shared_static_opts = {}
    shared_static_opts['step_cost'] = -.1
    shared_static_opts['water_cost'] = -.2

    #####################################
    # goto:
    go_dict = {}
    for i in shared_static_opts:
        go_dict[i] = shared_static_opts[i]
    go_dict['fixed_goal'] = False
    go_dict['map_width'] = [3, 3, 3, 10, 1]
    go_dict['map_height'] = [3, 3, 3, 10, 1]
    go_dict['nblocks'] = [0, 0, 0, 5, 1]
    go_dict['nwater'] = [0, 0, 0, 5, 1]
    goto_opts = {'game_opts': gf.opts_from_dict(go_dict),
                'featurizer': opts['featurizer']}
    opts['goto'] = goto_opts
    games['goto'] = goto
    
    #fixme:
    h = opts['goto']['map_height'].max_possible()
    w = opts['goto']['map_width'].max_possible()
    opts['featurizer']['max_map_sizes'] = (w,h)


    return game_opts, games, featurizer_class
Exemplo n.º 5
0
def get_opts():
    game_opts = {}
    game_opts['step_cost'] = -.1
    game_opts['water_cost'] = -.2
    game_opts['map_width'] = 8
    game_opts['map_height'] = 8
    game_opts['nblocks'] = 0
    game_opts['nwater'] = 0
    opts = {'game_opts': gf.opts_from_dict(game_opts)}
    return opts
Exemplo n.º 6
0
def get_opts_with_args(args):
    game_opts = {}
    if args.sp:
        game_opts['test_mode'] = False
    else:
        game_opts['test_mode'] = True
    game_opts['step_cost'] = -.1
    game_opts['water_cost'] = -.2
    game_opts['map_width'] = 7
    game_opts['map_height'] = 7
    game_opts['nblocks'] = 0
    game_opts['nwater'] = 0
    opts = {'game_opts': gf.opts_from_dict(game_opts)}
    return opts
Exemplo n.º 7
0
def game_opts():
    #featurizer_class = GridFeaturizer
    featurizer_class = ObjFeaturizer
    games = {}
    opts = {}
    opts['featurizer'] = {}
    shared_static_opts = {}
    shared_static_opts['step_cost'] = -.1
    shared_static_opts['water_cost'] = -.2

    #####################################
    # cond:
    g_dict = {}
    for i in shared_static_opts:
        g_dict[i] = shared_static_opts[i]
    g_dict['fixed_goal'] = True
    g_dict['map_width'] = [8, 8, 8, 8, 0]
    g_dict['map_height'] = [8, 8, 8, 8, 0]
    g_dict['nblocks'] = [2, 2, 2, 2, 0]
    g_dict['nwater'] = [1, 1, 1, 1, 0]
    g_dict['nswitches'] = [1, 1, 1, 1, 0]
    g_dict['ncolors'] = [2, 2, 2, 2, 0]

    g_opts = {
        'game_opts': gf.opts_from_dict(g_dict),
        'featurizer': opts['featurizer']
    }
    opts['lightkey'] = g_opts
    games['lightkey'] = lightkey

    #fixme:
    h = opts['lightkey']['game_opts']['map_height'].max_possible()
    w = opts['lightkey']['game_opts']['map_width'].max_possible()
    opts['featurizer']['max_map_sizes'] = (w, h)

    return opts, games, featurizer_class
Exemplo n.º 8
0
        actions.append('up')
        actions.append('down')
        actions.append('left')
        actions.append('right')
        actions.append('stop')
        return actions


if __name__ == '__main__':
    import mazebase.featurizer as sf
    opts = {
        'map_width': 10,
        'map_height': 10,
        'step_cost': -.1,
        'nblocks': 3,
        'nwater': 3
    }
    g = Game(opts)
    game_opts = gf.opts_from_dict({'map_width': 10,
                            'map_height': 10, 'step_cost': -.1,
                            'nblocks': 5, 'nwater': 5,
                            'water_cost': -.2, 'fixed_goal': False})
    F = Factory('goto',
                {'game_opts': game_opts,
                 'featurizer': {}},
                Game)

    feat = sf.SentenceFeaturizer({'egocentric_coordinates': True,
                                  'visible_range': 5},
                                 F.dictionary)
Exemplo n.º 9
0
    shared_static_opts = {}
    shared_static_opts['step_cost'] = -.1
    shared_static_opts['water_cost'] = -.2

    #####################################
    # goto:
    go_dict = {}
    for i in shared_static_opts:
        go_dict[i] = shared_static_opts[i]
    go_dict['fixed_goal'] = True
    go_dict['map_width'] = [5, 10, 5, 10, 1]
    go_dict['map_height'] = [5, 10, 5, 10, 1]
    go_dict['nblocks'] = [1, 5, 1, 5, 1]
    go_dict['nwater'] = [1, 5, 1, 5, 1]
    goto_opts = {
        'game_opts': gf.opts_from_dict(go_dict),
        'featurizer': opts['featurizer']
    }
    opts['goto'] = goto_opts
    games['goto'] = goto

    #####################################
    # switches:
    go_dict = {}
    for i in shared_static_opts:
        go_dict[i] = shared_static_opts[i]
    go_dict['map_width'] = [5, 10, 5, 10, 1]
    go_dict['map_height'] = [5, 10, 5, 10, 1]
    go_dict['nblocks'] = [1, 5, 1, 5, 1]
    go_dict['nwater'] = [1, 5, 1, 5, 1]
    go_dict['nswitches'] = [3, 5, 3, 5, 1]