All sailors must understand the rules of the road in order to prevent a collision at sea. International Regulations for Preventing Collisions at Sea were published in 1972 by the International Maritime Organization to standardize rules and practices for all vessels. Turning a boat while at sea can take a while, especially for a large tanker, so when you're a collision course with another vessel it's important to know what you're expected to do first time and thus preventing one of those silly dances people do in the street when they both step the same way.
When two vessels meet each other, the rules designate one vessel as the stand-on vessel and the other as the give-way vessel. The stand-on vessel must continue it's course and should not change either it's direction or it's speed, while the give-way vessel must turn away to avoid the collision. Below are the basic rules for understanding which is the stand-on and the give-way vessel:
When two sailing vessels are on the same tack the vessel on the starboard tack is the stand-on vessel. The vessel on the port tack must give way.
The windward boat is the give way vessel when two sailing vessels are on the same tack. The leeward vessel is the stand on vessel.
Both vessels must turn to starboard to avoid a head on collision. This applies to both sailing vessels and motorboats.