✌️Rock Paper Scissors

Probability

Rock Paper Scissors (RPS) uses the function random function which has three possible outcomes: 0, 1 and 2.

```ralph
    fn random(max_value: U256) -> (U256){
      let seed = u256From32Byte!(blake2b!(toByteVec!(blockTarget!()) ++ toByteVec!(blockTimeStamp!())))
      return addModN!(0,seed, max_value)
    }
    
    pub fn rps(choice: U256, amount: U256, feeAmount: U256) -> () {
      let randomValue = random(3)
      // function to check whether win or lose based on rps logic
    }
```
Player outcome
Probability

Rock

33.3%

Paper

33.3%

Scissors

33.3%

Outcomes

Player outcome
Multiplier

Win

2x

Draw

1x

Loss

0x

Last updated