implemented maze searching algorithm