diff --git a/cmd/max_word_count/max_word_count.go b/cmd/max_word_count/max_word_count.go index 8d440c5..699c591 100644 --- a/cmd/max_word_count/max_word_count.go +++ b/cmd/max_word_count/max_word_count.go @@ -20,7 +20,7 @@ func main() { var bestBoard boggle.Board var bestBoardCount = 0 - for _ = range 100_000 { + for range 100_000 { b := boggle.Shake(boggle.ClassicDice) boardWordsDict := b.AllWords(dict) // fmt.Println(boardWordsDict.Size()) diff --git a/cmd/playable_words/playable_words.go b/cmd/playable_words/playable_words.go index a3c2219..ef906a2 100644 --- a/cmd/playable_words/playable_words.go +++ b/cmd/playable_words/playable_words.go @@ -10,7 +10,9 @@ import ( func main() { unfiltered := dictionary.Map{} - dictionary.Load(dictionary.CSW19, unfiltered) + if err := dictionary.Load(dictionary.CSW19, unfiltered); err != nil { + panic(err) + } sizePlayable, _ := filter(unfiltered, boggle.Playable) // fmt.Printf("Excluded for size: %v\n", sizeExcluded) @@ -18,15 +20,17 @@ func main() { newPlayable := evaluate(sizePlayable, boggle.NewDice) onlyClassic := filterExclusive(classicPlayable, newPlayable) - // fmt.Printf("Only classic-playable:\n %+v\n", onlyClassic) + onlyNew := filterExclusive(newPlayable, classicPlayable) fucklike, _ := filterSlice(onlyClassic, func(word string) bool { return strings.ContainsRune(word, 'f') && strings.ContainsRune(word, 'k') }) - fmt.Printf("%d/%d Classic-exclusive words contain 'f' and 'k'", fucklike.Size(), len(onlyClassic)) - // onlyNew := filterExclusive(newPlayable, classicPlayable) - // fmt.Printf("Only new-playable:\n %+v\n", onlyNew) + fmt.Printf("Classic playable: %d\n", classicPlayable.Size()) + fmt.Printf("New playable: %d\n", newPlayable.Size()) + fmt.Printf("Only classic: %d\n", len(onlyClassic)) + fmt.Printf("Only new: %d\n", len(onlyNew)) + fmt.Printf("%d/%d Classic-exclusive words contain 'f' and 'k'\n", fucklike.Size(), len(onlyClassic)) } func evaluate(sizePlayable dictionary.Map, dice [16]boggle.Die) dictionary.Map { diff --git a/cmd/sameness/sameness.go b/cmd/sameness/sameness.go index c475c5a..140090c 100644 --- a/cmd/sameness/sameness.go +++ b/cmd/sameness/sameness.go @@ -17,7 +17,7 @@ const ( func main() { classicUniqueCounts := []string{} newUniqueCounts := []string{} - for _ = range 1_000 { + for range 1_000 { classicUnique, _ := evaluate(boggle.ClassicDice) classicUniqueCounts = append(classicUniqueCounts, strconv.Itoa(classicUnique)) newUnique, _ := evaluate(boggle.NewDice) @@ -40,16 +40,12 @@ func evaluate(dice [16]boggle.Die) (unique, common int) { wordCounts := map[string]int{} - for _ = range GamesPerSession { - b := boggle.Shake(boggle.ClassicDice) + for range GamesPerSession { + b := boggle.Shake(dice) boardWordsDict := b.AllWords(dict) for _, word := range boardWordsDict.Members() { - if _, ok := wordCounts[word]; ok { - wordCounts[word]++ - } else { - wordCounts[word] = 1 - } + wordCounts[word]++ } } diff --git a/cmd/word_counts/word_counts.go b/cmd/word_counts/word_counts.go index 5189167..627db86 100644 --- a/cmd/word_counts/word_counts.go +++ b/cmd/word_counts/word_counts.go @@ -19,7 +19,7 @@ func main() { log.Fatal(err.Error()) } - for _ = range 10_000 { + for range 10_000 { b := boggle.Shake(boggle.ClassicDice) boardWordsDict := b.AllWords(dict) fmt.Println(boardWordsDict.Size()) diff --git a/pkg/boggle/die.go b/pkg/boggle/die.go index 315f0c8..8bd44d6 100644 --- a/pkg/boggle/die.go +++ b/pkg/boggle/die.go @@ -89,7 +89,7 @@ var ( newDie7 = newDie{"d", "e", "l", "r", "v", "y"} newDie8 = newDie{"d", "i", "s", "t", "t", "y"} newDie9 = newDie{"e", "e", "g", "h", "n", "w"} - newDie10 = newDie{"e", "e", "i", "n", "s", "v"} + newDie10 = newDie{"e", "e", "i", "n", "s", "u"} newDie11 = newDie{"e", "h", "r", "t", "v", "w"} newDie12 = newDie{"e", "i", "o", "s", "s", "t"} newDie13 = newDie{"e", "l", "r", "t", "t", "y"} diff --git a/pkg/dictionary/map.go b/pkg/dictionary/map.go index 1b0944b..4b79346 100644 --- a/pkg/dictionary/map.go +++ b/pkg/dictionary/map.go @@ -17,7 +17,7 @@ func (d Map) CanBePrefix(pre string) bool { func (d Map) Members() []string { result := make([]string, 0, len(d)) - for word, _ := range d { + for word := range d { result = append(result, word) } return result diff --git a/pkg/game/tea.go b/pkg/game/tea.go index dea40dc..50d8138 100644 --- a/pkg/game/tea.go +++ b/pkg/game/tea.go @@ -143,7 +143,7 @@ func Run( finalModel := final.(model) scoredWords := make([]string, 0, len(finalModel.scoredWords)) - for word, _ := range finalModel.scoredWords { + for word := range finalModel.scoredWords { scoredWords = append(scoredWords, word) } return scoredWords, nil