1 """ Generate some tunnels and print them. """
16 cx, cy = int(w / 2), int(h / 2)
19 block_width = gap_width + wall_width
23 wall = obstacle_defaults.copy()
24 top = cx - (gap_width / 2) + (i * block_width)
25 bottom = top - wall_width
26 left = cy + (gap_width / 2) + (j * block_width)
27 right = left + wall_width
29 [left, top], [right, top], [right, bottom], [left, bottom],
35 for i in (-2, -1, 0, 1):
36 for j in (-2, -1, 0, 1, 2, 3):
37 walls.append(make_wall(i, j))
40 with open(replace, "r") as f:
41 station = json.load(f)
42 station["obstacles"] = walls
43 with open(replace, "w") as f:
44 json.dump(station, f, indent=2)
46 print json.dumps(walls, indent=2)