Beispiel #1
0
def input_file(path):
    with open(path, 'r') as f:
        start = tuple([int(x) for x in f.readline().strip().split(',')])
        end = tuple([int(x) for x in f.readline().strip().split(',')])
        types = np.genfromtxt(f, dtype='str', delimiter=1)
        grid = blank_grid(types.shape[0], types.shape[1])
        for (i, s) in np.ndenumerate(grid):
            (x, y) = i
            s.type = types[x, y]
        return (grid, start, end)
Beispiel #2
0
                    help='The filename to be used as the output file')
parser.add_argument('--width',
                    '-x',
                    metavar='#',
                    type=int,
                    default=160,
                    help='The width of the map')
parser.add_argument('--height',
                    '-y',
                    metavar='#',
                    type=int,
                    default=120,
                    help='The height of the map')
args = parser.parse_args()

grid = blank_grid(args.width, args.height)

print('Testing rough')
grid = maps.gen_rough(grid)

print('Testing gen_highways')
h = None
while h is None:
    try:
        h = maps.gen_highways(grid)
    except Exception as e:
        print(e)
        print('Retrying')
grid = h

print('Testing blocked')
Beispiel #3
0
 def setUp(self):
     self.g = blank_grid(120, 120)
     (start, end) = gen_start_goal_pair(self.g)
     self.start = start
     self.end = end
Beispiel #4
0
 def setUp(self):
     self.grid = blank_grid(3, 3)
     pass