starting maze algorithm