A smart contract for Alice and Bob to play rock, paper, scissors. Alice and Bob deposit 1 ETH to the smart contract. The winner gets 2 ETH or both receive 1 ETH back in case of a draw.
The smart contract is trustless, meaning Alice or Bob do not have to trust each other to participate. The code guarantees the game is fair. Neither Alice nor Bob can cheat in the process, and no third party can tamper with the result. In addition, we should incentive all parties to act accordingly and punish actions that are not expected.