Optimal and game control algorithms of a ship in collision situations at sea