wrote most of the logic for maze generation