Algorithm of finding of an optimal path in the maze matrix (wave algorithm analogue)