Usually, commitment schemes are used for this: https://en.wikipedia.org/wiki/Commitment_scheme
(However, if the stakes are high enough, the party that learns the outcome first can choose to exit the protocol if they are unsatisfied with the result.)
replies(2):