@@ -32,12 +32,10 @@ var (
3232)
3333
3434type wordle struct {
35- wordLength int
36- maxGuesses int
37- word string
38- guesses []map [string ][wordLength ]tileColor
39- in io.Reader
40- out io.Writer
35+ word string
36+ guesses []map [string ][wordLength ]tileColor
37+ in io.Reader
38+ out io.Writer
4139}
4240
4341func (w * wordle ) displayRow (word string , colors [wordLength ]tileColor ) {
@@ -96,13 +94,13 @@ func (w *wordle) getLetterTileColors(guess string) [wordLength]tileColor {
9694
9795func (w * wordle ) displayEmptyRows (guessCount int ) {
9896 emptyGuessChars := []string {}
99- for i := 0 ; i < w . wordLength ; i ++ {
97+ for i := 0 ; i < wordLength ; i ++ {
10098 emptyGuessChars = append (emptyGuessChars , "*" )
10199 }
102100
103101 emptyGuess := strings .Join (emptyGuessChars , "" )
104102 emptyTileColors := w .getLetterTileColors (emptyGuess )
105- emptyRowCount := w . maxGuesses - guessCount - 1
103+ emptyRowCount := maxGuesses - guessCount - 1
106104
107105 for i := 0 ; i < emptyRowCount ; i ++ {
108106 w .displayRow (emptyGuess , emptyTileColors )
@@ -119,9 +117,9 @@ func (w *wordle) run() {
119117 w .write (fmt .Sprintf ("Version: \t %s\n " , version ))
120118 w .write ("Info: \t \t https://github.com/mdb/wordle\n " )
121119 w .write ("About: \t \t A CLI adaptation of Josh Wardle's Wordle (https://powerlanguage.co.uk/wordle/)\n \n " )
122- w .write (fmt .Sprintf ("Guess a %v-letter word within %v guesses...\n " , w . wordLength , w . maxGuesses ))
120+ w .write (fmt .Sprintf ("Guess a %v-letter word within %v guesses...\n " , wordLength , maxGuesses ))
123121
124- for guessCount := 0 ; guessCount < w . maxGuesses ; guessCount ++ {
122+ for guessCount := 0 ; guessCount < maxGuesses ; guessCount ++ {
125123 w .write (fmt .Sprintf ("\n Guess (%v/%v): " , len (w .guesses )+ 1 , maxGuesses ))
126124
127125 reader .Scan ()
@@ -154,11 +152,9 @@ func (w *wordle) run() {
154152
155153func newWordle (word string , in io.Reader , out io.Writer ) * wordle {
156154 return & wordle {
157- wordLength : wordLength ,
158- maxGuesses : maxGuesses ,
159- word : word ,
160- in : in ,
161- out : out ,
155+ word : word ,
156+ in : in ,
157+ out : out ,
162158 }
163159}
164160
0 commit comments