def gen.pick

minebender-game@1.0.0.0 · game.bend:141

import minebender-game@1.0.0.0/game.bend as Game
import Base

141# Whether the next candidate gets a mine: forced when every candidate left
142# needs one, else a coin flip that comes up heads about need/left of the time.
143def gen.pick(+need: Nat, +left: Nat, rs: List<&2, U32>) -> Bool:
144  match rs:
145    case Nil{}:
146      Nat.is_eq(need, left)
147    case r <> t:
148      Nat.is_eq(need, left) || gen.coin(r, left, need)

Uses (7)

Used by (6)