- commit
- f65b7c4853af69f63940ac5c592a8ebf56d21fb9
- parent
- 35d88ce1dba67c31115ba0cf8f250591bbcc3e78
- author
- Dami <dami.etoile@gmail.com>
| M | hashiwokakero/ | 46 | ++---------------------------- |
| M | sudokurgb/ | 34 | ---------------------- |
| M | sudokurgb/ | 2 | +- |
@@ -11,6 +11,7 @@ import (
1111 )1212 1313 const cellWidth = 514+1415 const islandPillWidth = game.DynamicGridCellWidth1516 1617 type cellVisual struct {@@ -51,46 +52,6 @@ func baseCellStyle(fg, bg color.Color, bold bool) lipgloss.Style {
5152 return style5253 }5354 54-func selectedIslandStyle() lipgloss.Style {55- bg := theme.Current().SelectionBG56- return lipgloss.NewStyle().57- Width(islandPillWidth).58- AlignHorizontal(lipgloss.Center).59- Foreground(theme.TextOnBG(bg)).60- Background(bg).61- Bold(true)62-}63-64-func satisfiedIslandStyle() lipgloss.Style {65- p := theme.Current()66- return lipgloss.NewStyle().67- Width(islandPillWidth).68- AlignHorizontal(lipgloss.Center).69- Foreground(theme.TextOnBG(p.SuccessBG)).70- Background(p.SuccessBG).71- Bold(true)72-}73-74-func overfilledIslandStyle() lipgloss.Style {75- p := theme.Current()76- return lipgloss.NewStyle().77- Width(islandPillWidth).78- AlignHorizontal(lipgloss.Center).79- Foreground(theme.TextOnBG(p.ErrorBG)).80- Background(p.ErrorBG).81- Bold(true)82-}83-84-func adjacentIslandStyle() lipgloss.Style {85- bg := adjacentIslandBackground()86- return lipgloss.NewStyle().87- Width(islandPillWidth).88- AlignHorizontal(lipgloss.Center).89- Foreground(theme.TextOnBG(bg)).90- Background(bg).91- Bold(true)92-}93-9455 func bridgeColors() []color.Color {9556 return theme.Current().ThemeColors()9657 }@@ -341,8 +302,7 @@ func bridgeBold(m Model, bridge game.DynamicGridBridge) bool {
341302 }342303 343304 func bridgeIndexForDynamicBridge(p *Puzzle, bridge game.DynamicGridBridge) int {344- count, index := dynamicBridgeIdentity(p, bridge)345- _ = count305+ _, index := dynamicBridgeIdentity(p, bridge)346306 return index347307 }348308 @@ -351,7 +311,7 @@ func bridgeCountForDynamicBridge(p *Puzzle, bridge game.DynamicGridBridge) int {
351311 return count352312 }353313 354-func dynamicBridgeIdentity(p *Puzzle, bridge game.DynamicGridBridge) (count int, index int) {314+func dynamicBridgeIdentity(p *Puzzle, bridge game.DynamicGridBridge) (int, int) {355315 for i := 0; i < bridge.Count; i++ {356316 cell := p.CellContent(bridge.Cells[i].X, bridge.Cells[i].Y)357317 switch cell.Kind {@@ -154,10 +154,6 @@ func fillGridRec(g *grid, rng *rand.Rand, state *quotaState) bool {
154154 return false155155 }156156 157-func fillGrid(g *grid) bool {158- return fillGridSeeded(g, newRNG())159-}160-161157 func fillGridSeeded(g *grid, rng *rand.Rand) bool {162158 state, ok := buildQuotaState(g)163159 if !ok {@@ -306,33 +302,3 @@ func GenerateProvidedCellsSeeded(mode SudokuRGBMode, rng *rand.Rand) []cell {
306302 307303 return bestCells308304 }309-310-func isValid(g *grid, value, x, y int) bool {311- if value < 1 || value > valueCount {312- return false313- }314-315- rowCount, colCount, boxCount := 0, 0, 0316- boxX, boxY := (x/3)*3, (y/3)*3317- for i := range gridSize {318- if i != x && g[y][i].v == value {319- rowCount++320- }321- if i != y && g[i][x].v == value {322- colCount++323- }324- }325- for dy := range 3 {326- for dx := range 3 {327- cx, cy := boxX+dx, boxY+dy328- if cx == x && cy == y {329- continue330- }331- if g[cy][cx].v == value {332- boxCount++333- }334- }335- }336-337- return rowCount < houseQuota && colCount < houseQuota && boxCount < houseQuota338-}@@ -77,7 +77,7 @@ func cellView(m Model, x, y int, solved bool) string {
7777 7878 func cellStyle(m Model, c cell, x, y int, conflict, solved bool) lipgloss.Style {7979 isCursor := m.cursor.X == x && m.cursor.Y == y80- base := lipgloss.NewStyle()80+ var base lipgloss.Style8181 8282 switch c.v {8383 case 0: