@[instance_reducible]
Equations
@[instance_reducible]
Equations
- Sokoban.instDecidableEqTile.decEq { player := a, box := a_1, target := a_2, wall := a_3 } { player := b, box := b_1, target := b_2, wall := b_3 } = if h : a = b then h ▸ if h : a_1 = b_1 then h ▸ if h : a_2 = b_2 then h ▸ if h : a_3 = b_3 then h ▸ isTrue ⋯ else isFalse ⋯ else isFalse ⋯ else isFalse ⋯ else isFalse ⋯
Instances For
@[instance_reducible]
Equations
- Sokoban.instFintypeTile = Fintype.ofEquiv ((_ : Bool) × (_ : Bool) × (_ : Bool) × Bool) Sokoban.Tile.proxyTypeEquiv
@[instance_reducible]
Equations
@[instance_reducible]
Equations
- Sokoban.instDecidableEqState.decEq { width := a, height := a_1, grid := a_2, player := a_3, unsolvedNum := a_4 } { width := b, height := b_1, grid := b_2, player := b_3, unsolvedNum := b_4 } = if h : a = b then h ▸ if h : a_1 = b_1 then h ▸ if h : a_2 = b_2 then h ▸ if h : a_3 = b_3 then h ▸ if h : a_4 = b_4 then h ▸ isTrue ⋯ else isFalse ⋯ else isFalse ⋯ else isFalse ⋯ else isFalse ⋯ else isFalse ⋯
Instances For
Instances
Equations
- s.movePlayer p = { width := s.width, height := s.height, grid := s.grid.modifyMany [(s.player, fun (d : Sokoban.Tile) => { player := false, box := d.box, target := d.target, wall := d.wall }), (p, fun (d : Sokoban.Tile) => { player := true, box := d.box, target := d.target, wall := d.wall })], player := p, unsolvedNum := s.unsolvedNum }
Instances For
Equations
- s.moveBox p₁ p₂ = { width := s.width, height := s.height, grid := s.grid.modifyMany [(p₁, fun (d : Sokoban.Tile) => { player := d.player, box := false, target := d.target, wall := d.wall }), (p₂, fun (d : Sokoban.Tile) => { player := d.player, box := true, target := d.target, wall := d.wall })], player := s.player, unsolvedNum := (s.unsolvedNum + if (Map.get! p₁ s.grid).target = true then 1 else 0) - if (Map.get! p₂ s.grid).target = true then 1 else 0 }
Instances For
Equations
- s.move m = do let d₁ ← Map.get? (s.player + Dir.point m) s.grid guard ((!d₁.wall) = true) if (!d₁.box) = true then some (s.movePlayer (s.player + Dir.point m)) else have p₂ := s.player + Dir.point m + Dir.point m; do let d₂ ← Map.get? p₂ s.grid guard ((!(d₂.box || d₂.wall)) = true) some ((s.moveBox (s.player + Dir.point m) p₂).movePlayer (s.player + Dir.point m))
Instances For
Equations
- Sokoban.sys = { initial := {s : Sokoban.State | s.WF}, tr := Sokoban.State.move }