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)
sys.exit(1) except ValueError: iarg_ind = -1 else: print_pretty = False if len(sys.argv) >= 3 and sys.argv[-2][0] != "-": (height, width) = (int(sys.argv[-2]), int(sys.argv[-1])) else: (height, width) = (5, 10) Z, troll_list = gw.random_world((height, width), wall_density=0.2, num_init=1, num_goals=num_goals, num_trolls=N) for i in range(len(troll_list)): troll_list[i] = (troll_list[i][0], TROLL_RADIUS) print(Z.pretty(show_grid=True, line_prefix="## ")) print(Z.dumps(line_prefix="# ")) (spec, moves_N) = gw.add_trolls(Z, troll_list) print(spec.pretty()) if print_pretty: Z.plot(font_pt=0, troll_list=troll_list) if iarg_ind == -1: plt.show() else: plt.savefig(sys.argv[iarg_ind])