def flood_exact_c.go
minebender-game@1.0.0.0 · proof_laws.bend:814
import minebender-game@1.0.0.0/proof_laws.bend as ProofLaws
import Base
import minebender-game@1.0.0.0/types.bend as T
import minebender-game@1.0.0.0/board.bend as B
import minebender-game@1.0.0.0/game.bend as G
import minebender-game@1.0.0.0/LAWS.bend as L
import minebender-game@1.0.0.0/proof_flood.bend as PF
814def flood_exact_c.go(+w: Nat, +h: Nat, +layout: T.Grid(Bool), +s: T.Grid(Bool), +f: List<&2, T.Pos>,
815 +p: T.Pos, +q: T.Pos, +onq: {B.on_board(w, h, q) == True{} : Bool},
816 +hidq: {B.at(Bool, False{}, s, q) == False{} : Bool},
817 +c: Bool, +m: Bool,
818 after: {L.revealed(G.knowledge(G.open.go(c, m, G.Game{w, h, layout, s, f, T.Playing{}}, p)), q) == True{} : Bool}) ->
819 PF.Walk(w, h, layout, p, q):
820 match c m:
821 case False{} _:
822 PF.both_absurd(PF.Walk(w, h, layout, p, q), B.at(Bool, False{}, s, q), hidq,
823 %know_revealed(w, h, layout, s, f, T.Playing{}, q, onq) : {_ == True{} : Bool}; after)
824 case True{} True{}:
825 +s2 = B.set_at(Bool, s, p, True{})
826 exact_explode(w, h, layout, s, p, q, hidq,
827 %know_revealed(w, h, layout, s2, f, T.Lost{T.Exploded{p}}, q, onq) : {_ == True{} : Bool}; after,
828 B.same(p, q), {==})
829 case True{} False{}:
830 +start = {[G.Work{p, Nil{}}] : List<&2, G.Work>}
831 +cf = B.count_false(s)
832 +hh = G.head_hidden(w, h, s, start)
833 +fl = G.flood(cf, start, hh, w, h, layout, s)
834 +st = G.won_or_playing(G.all_safe(w, h, layout, fl))
835 PF.flood_path(cf, start, hh, w, h, layout, s, p, start_ok(w, h, layout, p), q, hidq,
836 %know_revealed(w, h, layout, fl, f, st, q, onq) : {_ == True{} : Bool}; after)