Step 3: The Reverse Flip Contingency
When the coin lands on heads, do the following:
IF (coin == "heads") THEN DO THE OPPOSITE OF WHAT YOU PLANNED TO DO END IF
And if it lands on tails... well, good luck with that.