def edges

minebender-game@1.0.0.0 · game.bend:429

import minebender-game@1.0.0.0/game.bend as Game
import Base
import minebender-game@1.0.0.0/types.bend as T
import minebender-game@1.0.0.0/board.bend as B

429# The cells of ps not revealed yet but next to a revealed one.
430def edges(+w: Nat, +h: Nat, +shown: T.Grid(Bool), ps: List<&2, T.Pos>) -> List<&2, T.Pos>:
431  match ps:
432    case Nil{}:
433      Nil{}
434    case +p <> t:
435      List.filter.put(T.Pos, p, edges(w, h, shown, t),
436        Bool.not(B.at(Bool, False{}, shown, p)) && any_shown(shown, B.neighbours(w, h, p)))

Uses (11)

Used by (4)