Skip to content

Commit

Permalink
Exiting if done.
Browse files Browse the repository at this point in the history
  • Loading branch information
archy-bold committed Jan 4, 2022
1 parent 3529eb3 commit 811b587
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ func main() {
input, _ := reader.ReadString('\n')
parts := strings.Split(strings.TrimSpace((input)), "")
boardRow := ""
numCorrect := 0
for i, chr := range parts {
if chr == "x" {
letters[wordParts[i]] = false
} else if chr == "y" {
boardRow += COLOUR_GREEN
answersCorrect[i] = wordParts[i]
numCorrect++
} else if chr == "o" {
boardRow += COLOUR_YELLOW
answersIncorrect[i] = append(answersIncorrect[i], wordParts[i])
Expand All @@ -92,7 +94,10 @@ func main() {

outputBoard()

// TODO exit if correct
if numCorrect == NUM_LETTERS {
fmt.Println("Hooray!")
return
}
}
}

Expand Down
Binary file modified wordle-solver
Binary file not shown.

0 comments on commit 811b587

Please sign in to comment.