created a check to ensure maze end is within bounds of maze dimensions