Skip to content

Commit

Permalink
use struct field rather than global var
Browse files Browse the repository at this point in the history
  • Loading branch information
mdb committed Feb 8, 2022
1 parent c3a4f64 commit b1eb172
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = 0.0.3
VERSION = 0.0.4
SOURCE = ./...

.DEFAULT_GOAL := build
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (w *wordle) run() {
w.write(fmt.Sprintf("Guess a %v-letter word within %v guesses...\n", w.wordLength, w.maxGuesses))

for guessCount := 0; guessCount < w.maxGuesses; guessCount++ {
w.write(fmt.Sprintf("\nGuess (%v/%v): ", len(w.guesses)+1, maxGuesses))
w.write(fmt.Sprintf("\nGuess (%v/%v): ", len(w.guesses)+1, w.maxGuesses))

reader.Scan()
guess := strings.ToUpper(reader.Text())
Expand All @@ -132,7 +132,7 @@ func (w *wordle) run() {
}

if len(guess) != len(w.word) {
w.write(fmt.Sprintf("%s is not a %v-letter word. Try again...\n", guess, wordLength))
w.write(fmt.Sprintf("%s is not a %v-letter word. Try again...\n", guess, w.wordLength))
guessCount--
}

Expand All @@ -144,7 +144,7 @@ func (w *wordle) run() {
break
}

if guessCount == maxGuesses-1 {
if guessCount == w.maxGuesses-1 {
fmt.Println()
w.displayRow(w.word, w.getLetterTileColors(w.word))
os.Exit(1)
Expand Down

0 comments on commit b1eb172

Please sign in to comment.