- commit
- f55f9d04c07b4833b69a9d4d7cd558f5a7b79c4a
- parent
- a53abecafb98b5ef02abe5260cf40d111d0abe6c
- author
- Dami <dami@Damis-MacBook-Air.local>
| M | hashiwokakero/ | 6 | +++--- |
| M | hashiwokakero/ | 6 | +++--- |
| M | model.go | 4 | ++-- |
| M | nonogram/ | 6 | ++---- |
| M | wordsearch/ | 4 | ++-- |
@@ -33,7 +33,7 @@ func (h HashiMode) Spawn() (game.Gamer, error) {
3333 }3434 3535 var Modes = []list.Item{36- NewMode("Easy - 7x7", "Connect islands with bridges on a 7x7 grid.", 7, 7, 6, 8),37- NewMode("Medium - 9x9", "Connect islands with bridges on a 9x9 grid.", 9, 9, 10, 14),38- NewMode("Hard - 13x13", "Connect islands with bridges on a 13x13 grid.", 13, 13, 18, 24),36+ NewMode("Easy - 7x7", "Connect islands with bridges on a 7x7 grid.", 7, 7, 8, 12),37+ NewMode("Medium - 9x9", "Connect islands with bridges on a 9x9 grid.", 9, 9, 12, 16),38+ NewMode("Hard - 13x13", "Connect islands with bridges on a 13x13 grid.", 13, 13, 20, 26),3939 }@@ -66,9 +66,9 @@ func placeIslands(width, height, count int) []Island {
6666 occupied := make(map[pos]bool)6767 islands := make([]Island, 0, count)6868 69- for i := 0; i < count; i++ {69+ for i := range count {7070 placed := false71- for attempts := 0; attempts < 200; attempts++ {71+ for range 200 {7272 x := rand.Intn(width)7373 y := rand.Intn(height)7474 p := pos{x, y}@@ -118,7 +118,7 @@ func buildSpanningTree(p *Puzzle) bool {
118118 type pair struct{ id1, id2 int }119119 var pairs []pair120120 121- for i := 0; i < len(p.Islands); i++ {121+ for i := range len(p.Islands) {122122 for j := i + 1; j < len(p.Islands); j++ {123123 a := p.Islands[i]124124 b := p.Islands[j]@@ -19,10 +19,10 @@ var (
1919 debugStyle = lipgloss.NewStyle().Border(lipgloss.RoundedBorder(), true).BorderForeground(lipgloss.Color("124"))2020 2121 GameCategories = []list.Item{22+ game.Category{Name: "Hashiwokakero", Desc: "Connect islands with bridges.", Modes: hashiwokakero.Modes},2223 game.Category{Name: "Nonogram", Desc: "Fill cells to match row and column hints.", Modes: nonogram.Modes},23- game.Category{Name: "Word Search", Desc: "Find hidden words in a letter grid.", Modes: wordsearch.Modes},2424 game.Category{Name: "Sudoku", Desc: "Fill the 9x9 grid following sudoku rules.", Modes: sudoku.Modes},25- game.Category{Name: "Hashiwokakero", Desc: "Connect islands with bridges.", Modes: hashiwokakero.Modes},25+ game.Category{Name: "Word Search", Desc: "Find hidden words in a letter grid.", Modes: wordsearch.Modes},2626 }2727 )2828 @@ -60,7 +60,7 @@ var (
6060 }6161 6262 renderRuneMap = map[rune]string{63- filledTile: "███",63+ filledTile: "▐█",6464 markedTile: "✕",6565 emptyTile: " ",6666 }@@ -164,9 +164,7 @@ func tileView(val rune, isCursor, inCursorRow, inCursorCol, solved bool) string
164164 165165 if solved {166166 // Brighten filled tiles when solved167- if val == filledTile {168- s = s.Background(lipgloss.Color("#2a6a2a"))169- }167+ s = s.Background(lipgloss.Color("#2a6a2a"))170168 }171169 172170 r, ok := renderRuneMap[val]@@ -5,8 +5,8 @@ import (
55 "strings"66 77 "github.com/FelineStateMachine/puzzletea/game"8- tea "github.com/charmbracelet/bubbletea"98 "github.com/charmbracelet/bubbles/key"9+ tea "github.com/charmbracelet/bubbletea"1010 )1111 1212 type selectionState int@@ -202,7 +202,7 @@ func (m Model) GetDebugInfo() string {
202202 for _, word := range m.words {203203 found := "❌"204204 if word.Found {205- found = "✅"205+ found = "✓"206206 }207207 sb.WriteString(fmt.Sprintf("| %s | %s | (%d,%d) | (%d,%d) | %d |\n",208208 word.Text, found, word.Start.X, word.Start.Y, word.End.X, word.End.Y, word.Direction))