def custom
import minebender-game@1.0.0.0/LAWS.bend as LAWSimport Base
import minebender-game@1.0.0.0/types.bend as T
517# Windows XP's Custom Field dialog: width is clamped to 9..30, height to
518# 9..25 and mines to 10..999, then mines are capped at width*height - 10.
519def custom(w: Nat, h: Nat, m: Nat) -> T.Setup:
520 +cw = clamp(9n, 30n, w)
521 +ch = clamp(9n, 25n, h)
522 T.Setup{cw, ch, Nat.min(clamp(10n, 999n, m), Nat.sub(Nat.mul(cw, ch), 10n))}