12345678910111213141516171819 |
- package main
- type Word struct {
- Word string
- Score int
- }
- func (w Word) MatchesGuess(guess string, numMatchingChars int) bool {
- score := 0
- for idx, letter := range w.Word {
- if string(letter) == string(guess[idx]) {
- score++
- }
- }
- return score == numMatchingChars
- }
|