fix: double letter guess scored incorrectly
This commit is contained in:
parent
147cb22e88
commit
a39fce6c07
|
@ -49,6 +49,7 @@ func Check(word string, solution string) (correct, present []int) {
|
|||
// check if correct position
|
||||
if letter == int32(solution[i]) {
|
||||
correct = append(correct, i)
|
||||
exclude = append(exclude, i)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,12 @@ func TestCheck(t *testing.T) {
|
|||
wantCorrect: []int{0, 1, 2, 3, 4},
|
||||
wantPresent: []int{},
|
||||
},
|
||||
{
|
||||
name: "double letter guess",
|
||||
args: args{word: "trots", solution: "those"},
|
||||
wantCorrect: []int{0, 2},
|
||||
wantPresent: []int{4},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user