- commit
- 28e7fd57edca7cf472c74e91f3347a7164518cc9
- parent
- a050ef95a7989db672cbe761f835bbc9b613ec60
- author
- Dami <dami.etoile@gmail.com>
| M | nonogram/ | 10 | --------- |
| M | nonogram/ | 4 | ++-- |
| M | nurikabe/ | 6 | +++--- |
| M | nurikabe/ | 32 | ------------------------------ |
@@ -242,16 +242,6 @@ func countSolutionsRecursive(
242242 return count243243 }244244 245-func propagate(g solutionGrid, hints Hints, ctx context.Context) (solutionGrid, bool) {246- stack := undoStack{247- changes: make([]cellChange, 0, g.w*g.h),248- }249- if !propagateInPlace(&g, hints, ctx, &stack) {250- return g, false251- }252- return g, true253-}254-255245 func propagateInPlace(g *solutionGrid, hints Hints, ctx context.Context, stack *undoStack) bool {256246 rowBuf := make([]cellState, g.w)257247 colBuf := make([]cellState, g.h)@@ -1296,8 +1296,8 @@ func BenchmarkGenerateRandomTomographyModes(b *testing.B) {
12961296 12971297 func BenchmarkCountSolutionsLarge(b *testing.B) {12981298 cases := []struct {1299- name string1300- mode NonogramMode1299+ name string1300+ mode NonogramMode13011301 seedA uint6413021302 seedB uint6413031303 }{@@ -169,14 +169,6 @@ func CountSolutionsContext(ctx context.Context, puzzle Puzzle, limit, nodeLimit
169169 return solutions, stats, nil170170 }171171 172-func propagate(g grid, clues clueGrid) error {173- if len(g) == 0 || len(g[0]) == 0 {174- return nil175- }176- scratch := newSolverScratch(len(g[0]), len(g))177- return propagateWithScratch(g, clues, scratch)178-}179-180172 func propagateWithScratch(g grid, clues clueGrid, scratch *solverScratch) error {181173 height := len(g)182174 if height == 0 {@@ -252,14 +244,6 @@ func propagateWithScratch(g grid, clues clueGrid, scratch *solverScratch) error
252244 }253245 }254246 255-func validatePartial(g grid, clues clueGrid) error {256- if len(g) == 0 || len(g[0]) == 0 {257- return nil258- }259- scratch := newSolverScratch(len(g[0]), len(g))260- return validatePartialWithScratch(g, clues, scratch)261-}262-263247 func validatePartialWithScratch(g grid, clues clueGrid, scratch *solverScratch) error {264248 if hasSeaSquare(g) {265249 return fmt.Errorf("contains 2x2 sea block")@@ -389,14 +373,6 @@ func candidateOrder(g grid, clues clueGrid, x, y int) []cellState {
389373 return []cellState{seaCell, islandCell}390374 }391375 392-func seaCanRemainConnected(g grid) bool {393- if len(g) == 0 || len(g[0]) == 0 {394- return true395- }396- scratch := newSolverScratch(len(g[0]), len(g))397- return seaCanRemainConnectedWithScratch(g, scratch)398-}399-400376 func seaCanRemainConnectedWithScratch(g grid, scratch *solverScratch) bool {401377 height := len(g)402378 if height == 0 {@@ -628,14 +604,6 @@ func componentCanReachClueWithScratch(
628604 return false629605 }630606 631-func maxReachableForComponent(g grid, clues clueGrid, comp islandComponent) int {632- if len(g) == 0 || len(g[0]) == 0 {633- return 0634- }635- scratch := newSolverScratch(len(g[0]), len(g))636- return maxReachableForComponentWithScratch(g, clues, comp, scratch)637-}638-639607 func maxReachableForComponentWithScratch(640608 g grid,641609 clues clueGrid,