In the PPP lecture 7 state machines are introduced. They are used to make the guessing game more concise.
One of the situations is where the first player has won and needs to prove their guess by providing the nonce they originally used to hash the guess. A function was written for this named
check :: ByteString -> ByteString -> GameDatum -> GameRedeemer -> ScriptContext -> Bool check bsZero' bsOne' (GameDatum bs (Just c)) (Reveal nonce) _ = sha2_256 (nonce `concatenate` if c == Zero then bsZero' else bsOne') == bs check _ _ _ _ _ = True
This function is then assigned in the StateMachine definition as the
Is this function then used as a sort of predicate on every attempted transition to a new state?
Additionally, is this an example of pattern matching to the specific case where the transaction includes a redeemer and nonce?