|
@@ -35,6 +35,18 @@ func main() {
|
|
|
|
|
|
game.FilterWords(guess, score)
|
|
game.FilterWords(guess, score)
|
|
|
|
|
|
|
|
+ if len(game.Words) == 0 {
|
|
|
|
+ fmt.Printf("\n\nFATAL ERROR: something went wrong! No words are left, this shouldn't happen!!!!!!!\n\n")
|
|
|
|
+ os.Exit(1)
|
|
|
|
+
|
|
|
|
+ } else if len(game.Words) == 1 {
|
|
|
|
+ fmt.Printf("Game is down to one word: %+v\n", game.Words)
|
|
|
|
+ for word := range game.Words {
|
|
|
|
+ fmt.Printf("\n\nThe answer is: %s\n\n", word)
|
|
|
|
+ os.Exit(0)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
err = game.scoreWordsByCommonLetterLocations()
|
|
err = game.scoreWordsByCommonLetterLocations()
|
|
if err != nil {
|
|
if err != nil {
|
|
fmt.Printf("Error scoring Words: %s\n", err)
|
|
fmt.Printf("Error scoring Words: %s\n", err)
|
|
@@ -54,12 +66,6 @@ func main() {
|
|
}
|
|
}
|
|
fmt.Printf("Best Guess: %s", bestGuess)
|
|
fmt.Printf("Best Guess: %s", bestGuess)
|
|
|
|
|
|
- if len(game.Words) == 1 {
|
|
|
|
- for word := range game.Words {
|
|
|
|
- fmt.Printf("The word is: %s\n", word)
|
|
|
|
- os.Exit(0)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|