def zero_walk

minebender-game@1.0.0.0 · LAWS.bend:205

import minebender-game@1.0.0.0/LAWS.bend as LAWS
import Base
import minebender-game@1.0.0.0/types.bend as T

205# Starting at p, the path steps from cell to adjacent cell of the board,
206# leaving only zeros, and ends at q. The empty path goes from p to p.
207def zero_walk(path: List<&2, T.Pos>, +w: Nat, +h: Nat, +layout: T.Grid(Bool),
208  +p: T.Pos, q: T.Pos) -> Bool:
209  match path:
210    case Nil{}:
211      same(p, q)
212    case +r <> t:
213      zero(w, h, layout, p) && adjacent(p, r) && on_board(w, h, r)
214        && zero_walk(t, w, h, layout, r, q)

Uses (10)

Used by (17)