Skip to content

Commit

Permalink
fix #77: checking through all words to make sure word is actually a word
Browse files Browse the repository at this point in the history
  • Loading branch information
brensch committed Mar 10, 2022
1 parent ec365d3 commit 8870727
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@ const (

// TODO: get word list up in here
func ValidGuess(guess, answer string) bool {
return len(guess) == len(answer)
if len(guess) != len(answer) {
return false
}

for _, validWord := range CommonWords {
if validWord == guess {
return true
}
}

for _, validWord := range AllWords {
if validWord == guess {
return true
}
}
return false
}

func GetResult(guess, answer string) GuessResult {
Expand Down

0 comments on commit 8870727

Please sign in to comment.