fixed maze algorithm