Four of five wasted G=200 attempts ended in 'shared cells stay ambiguous with every one given': the tile's remaining ambiguity sat in shared cells it may not give, namely neighbours' planted flip cells. Those are now a second tier of seam-clue candidates; a neighbour whose alternative dies is caught by settle and re-given, which is cheaper than restarting the attempt. Junctions stay never-given.
- commit
- ee049c577a27eab4889baba0128bbc14fae2bfc3
- parent
- ae9363b17fb829e1983bea5c234b754c9cec2a9f
- author
- dami <gazey55@gmail.com>
| M | engine/ | 17 | +++++++++++++++-- |
@@ -1634,18 +1634,31 @@ func (m *mosaic) removeClues(ctx context.Context, rng *rand.Rand, ti int, S [][]
16341634 if countPT(build(), g.sh, M+1) <= M {16351635 return true16361636 }1637- var cands []int1637+ // two tiers: first the shared cells nobody has a stake in; then,1638+ // only if those do not suffice, cells a neighbour planted its flip1639+ // on (m.used). Giving one of those kills that neighbour's1640+ // alternative, which settle detects and regiven repairs; leaving1641+ // this tile ambiguous would fail the attempt outright. Junctions1642+ // (three or more owners) are never given.1643+ var cands, planted []int16381644 for i := range g.mask {16391645 if !g.mask[i] {16401646 continue16411647 }16421648 _, inherited := m.seamGivens[gid(i%W, i/W)]16431649 _, own := ownSeam[i]1644- if g.shared[i] && !g.junction[i] && !protect[i] && !inherited && !own && !m.used[gid(i%W, i/W)] {1650+ if !g.shared[i] || g.junction[i] || protect[i] || inherited || own {1651+ continue1652+ }1653+ if m.used[gid(i%W, i/W)] {1654+ planted = append(planted, i)1655+ } else {16451656 cands = append(cands, i)16461657 }16471658 }16481659 rng.Shuffle(len(cands), func(a, b int) { cands[a], cands[b] = cands[b], cands[a] })1660+ rng.Shuffle(len(planted), func(a, b int) { planted[a], planted[b] = planted[b], planted[a] })1661+ cands = append(cands, planted...)16491662 ok := false16501663 added := []int{}16511664 for _, i := range cands {