Maze creator in javascript