Skip to content

Commit

Permalink
Bundling the words into the executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
archy-bold committed Jan 6, 2022
1 parent d37c6db commit 6e1ff94
Show file tree
Hide file tree
Showing 4 changed files with 278 additions and 7 deletions.
273 changes: 273 additions & 0 deletions bindata.go

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
9 changes: 4 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func main() {
// Read the valid words
var err error
fmt.Print("Reading solutions... ")
err = readWordList(&validWords, "./words/5/solutions.txt")
err = readWordList(&validWords, "words/5/solutions.txt")
fmt.Printf("found %d\n", len(validWords))
check(err)

// Read the valid guesses
fmt.Print("Reading valid guesses... ")
err = readWordList(&allAcceptedWords, "./words/5/guesses.txt")
err = readWordList(&allAcceptedWords, "words/5/guesses.txt")
// Sort the valid guesses as we will be searching that array often
sort.Strings(allAcceptedWords)
fmt.Printf("found %d\n", len(allAcceptedWords))
Expand Down Expand Up @@ -223,13 +223,12 @@ func check(e error) {
}

func readWordList(arr *[]string, fname string) error {
file, err := os.Open(fname)
data, err := Asset(fname)
if err != nil {
return err
}
defer file.Close()

scanner := bufio.NewScanner(file)
scanner := bufio.NewScanner(strings.NewReader(string(data)))
i := 0
for scanner.Scan() {
word := scanner.Text()
Expand Down
Binary file modified wordle
Binary file not shown.

0 comments on commit 6e1ff94

Please sign in to comment.