Exemple #1
0
def scale_gridworld_test():
    G = gw.unoccupied((1, 2))
    assert G.size() == (1, 2)
    assert G.scale().size() == G.size()
    assert G.scale(xf=1, yf=1).size() == G.size()
    assert G.scale(xf=2).size() == (1, 4)
    assert G.scale(yf=2).size() == (2, 2)
    assert G.scale(xf=3, yf=4).size() == (4, 6)
def scale_gridworld_test():
    G = gw.unoccupied((1, 2))
    assert G.size() == (1, 2)
    assert G.scale().size() == G.size()
    assert G.scale(xf=1, yf=1).size() == G.size()
    assert G.scale(xf=2).size() == (1, 4)
    assert G.scale(yf=2).size() == (2, 2)
    assert G.scale(xf=3, yf=4).size() == (4, 6)
Exemple #3
0
def add_trolls_test():
    G = gw.unoccupied((3, 5))
    G.init_list = [(0, 0)]
    G.goal_list = [(0, 4)]
    spc = gw.add_trolls(G, [((2, 2), 1)], get_moves_lists=False)
    spc.moore = False
    spc.plus_one = False
    spc.qinit = r'\A \E'
    assert is_realizable('omega', spc)
def add_trolls_test():
    G = gw.unoccupied((3, 5))
    G.init_list = [(0, 0)]
    G.goal_list = [(0, 4)]
    spc = gw.add_trolls(G, [((2, 2), 1)], get_moves_lists=False)
    spc.moore = False
    spc.plus_one = False
    spc.qinit = r'\A \E'
    assert is_realizable(spc)
Exemple #5
0
def eq_gridworld_test():
    empty = gw.GridWorld()
    trivial_nonempty = gw.GridWorld(TRIVIAL_GWFILE)
    trivial_diff = gw.GridWorld(TRIVIAL_GWFILE)
    if trivial_diff.is_empty((0, 0)):
        trivial_diff.mark_occupied((0, 0))
    else:
        trivial_diff.mark_empty((0, 0))
    trivial_nonempty_2goals = gw.GridWorld(TRIVIAL_GWFILE)
    trivial_nonempty_2goals.goal_list = [(0, 0), (1, 1)]
    trivial_nonempty_2init = gw.GridWorld(TRIVIAL_GWFILE)
    trivial_nonempty_2init.init_list = [(0, 0), (1, 1)]
    for (G, H,
         is_equal) in [(gw.GridWorld(), gw.GridWorld(), True),
                       (empty, trivial_nonempty, False),
                       (trivial_nonempty_2goals, trivial_nonempty, False),
                       (trivial_nonempty_2init, trivial_nonempty, False),
                       (trivial_nonempty, trivial_diff, False),
                       (gw.unoccupied((3, 5)), gw.unoccupied((1, 1)), False)]:
        yield eq_gridworld_check, G, H, is_equal
def eq_gridworld_test():
    empty = gw.GridWorld()
    trivial_nonempty = gw.GridWorld(TRIVIAL_GWFILE)
    trivial_diff = gw.GridWorld(TRIVIAL_GWFILE)
    if trivial_diff.is_empty((0, 0)):
        trivial_diff.mark_occupied((0, 0))
    else:
        trivial_diff.mark_empty((0, 0))
    trivial_nonempty_2goals = gw.GridWorld(TRIVIAL_GWFILE)
    trivial_nonempty_2goals.goal_list = [(0, 0), (1, 1)]
    trivial_nonempty_2init = gw.GridWorld(TRIVIAL_GWFILE)
    trivial_nonempty_2init.init_list = [(0, 0), (1, 1)]
    for (G, H, is_equal) in [
            (gw.GridWorld(), gw.GridWorld(), True),
            (empty, trivial_nonempty, False),
            (trivial_nonempty_2goals, trivial_nonempty, False),
            (trivial_nonempty_2init, trivial_nonempty, False),
            (trivial_nonempty, trivial_diff, False),
            (gw.unoccupied((3, 5)), gw.unoccupied((1, 1)), False)]:
        yield eq_gridworld_check, G, H, is_equal