The paper devotes the algorithm of ship handling when the environmental parameters varied as the function of the way. In nautical practice, when the ships sail in the channel, they often arrange as the convoy with the leader ship. In order to ensure the maritime safety, the mariner should establish the algorithm for control of ship engine system and steering gear complex. In this research, the author uses the maximum principle of Pontryagin L.S to establish the similar control. However, in order to obtain these ranges of numerical solutions like this, sometimes it’s difficult to use the maximum principle. Because, there is not enough the initial condition for using of the auxiliary vector that is the quantity to define the time of control variation. These obstacles shall be cleared by the selection of the transversal conditions. The problems are solved under Maier’s and G. Kelly’s condition as well as the Hamiltonian operator and Cardano’s formula.