def flood_zero.take
minebender-game@1.0.0.0 · proof_flood.bend:419
import minebender-game@1.0.0.0/proof_flood.bend as ProofFlood
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/proof_base.bend as P
import minebender-game@1.0.0.0/proof_grid.bend as PG
import minebender-game@1.0.0.0/proof_lists.bend as PL
import minebender-game@1.0.0.0/proof_cells.bend as PS
419def flood_zero.take(+k: Nat, +c: T.Pos, +back: List<&2, T.Pos>, +rest: List<&2, G.Work>, +w: Nat, +h: Nat,
420 +layout: T.Grid(Bool), +shown: T.Grid(Bool), +q: T.Pos, +r: T.Pos,
421 +sh: {B.shaped(Bool, w, h, shown) == True{} : Bool},
422 +cnt: {1n+k == B.count_false(shown) : Nat},
423 +he: {G.unrevealed(w, h, shown, c) == True{} : Bool},
424 before: {B.at(Bool, False{}, shown, q) == False{} : Bool},
425 z: {B.zero(w, h, layout, q) == True{} : Bool},
426 +rm: {B.contains(B.neighbours(w, h, q), r) == True{} : Bool},
427 +b: Bool, +be: {B.same(c, q) == b : Bool},
428 ih: {B.at(Bool, False{}, B.set_at(Bool, shown, c, True{}), q) == False{} : Bool} ->
429 {B.at(Bool, False{}, G.flood(k, G.push(B.zero(w, h, layout, c), B.neighbours(w, h, c), back, rest),
430 G.head_hidden(w, h, B.set_at(Bool, shown, c, True{}), G.push(B.zero(w, h, layout, c), B.neighbours(w, h, c), back, rest)),
431 w, h, layout, B.set_at(Bool, shown, c, True{})), r) == True{} : Bool}) ->
432 {B.at(Bool, False{}, G.flood(k, G.push(B.zero(w, h, layout, c), B.neighbours(w, h, c), back, rest),
433 G.head_hidden(w, h, B.set_at(Bool, shown, c, True{}), G.push(B.zero(w, h, layout, c), B.neighbours(w, h, c), back, rest)),
434 w, h, layout, B.set_at(Bool, shown, c, True{})), r) == True{} : Bool}:
435 match b:
436 case True{}:
437 %Equal.sym(T.Pos, c, q, PG.same_sound(c, q, be)) :
438 {B.at(Bool, False{}, G.flood(k, G.push(B.zero(w, h, layout, _), B.neighbours(w, h, _), back, rest),
439 G.head_hidden(w, h, B.set_at(Bool, shown, _, True{}), G.push(B.zero(w, h, layout, _), B.neighbours(w, h, _), back, rest)),
440 w, h, layout, B.set_at(Bool, shown, _, True{})), r) == True{} : Bool}
441 %Equal.sym(Bool, B.zero(w, h, layout, q), True{}, z) :
442 {B.at(Bool, False{}, G.flood(k, G.push(_, B.neighbours(w, h, q), back, rest),
443 G.head_hidden(w, h, B.set_at(Bool, shown, q, True{}), G.push(_, B.neighbours(w, h, q), back, rest)),
444 w, h, layout, B.set_at(Bool, shown, q, True{})), r) == True{} : Bool}
445 +s2 = B.set_at(Bool, shown, q, True{})
446 +wk = List.append(&2, G.Work, G.works(B.neighbours(w, h, q), back), rest)
447 +hq = {%PG.same_sound(c, q, be) : {G.unrevealed(w, h, shown, _) == True{} : Bool};
448 he : {G.unrevealed(w, h, shown, q) == True{} : Bool}}
449 +ron = P.and_true_r(B.adjacent(q, r), B.on_board(w, h, r),
450 PS.allp_member(~PS.WHS, ~PS.adj_on, PS.WHS{w, h, q}, B.neighbours(w, h, q), r,
451 PS.neighbours_all(w, h, q), rm))
452 flood_work(k, wk, G.head_hidden(w, h, s2, wk), w, h, layout, s2,
453 PL.shaped_set(Bool, w, h, shown, q, True{}, sh), count_after(w, h, shown, q, k, sh, hq, cnt), {==}, r, ron,
454 wcontains_append_l(G.works(B.neighbours(w, h, q), back), rest, r,
455 wcontains_works(B.neighbours(w, h, q), back, r, rm)))
456 case False{}:
457 ih(%Equal.sym(Bool, B.at(Bool, False{}, B.set_at(Bool, shown, c, True{}), q), B.at(Bool, False{}, shown, q),
458 PL.at_set_ne(Bool, shown, c, q, True{}, False{}, be)) : {_ == False{} : Bool}; before)