Code: Select all
'user is the users input
'break here if a string has already been compared for this lyric
If scorer.score(lcount) <> 0 Then
user = ""
Dim As Integer g
If UCase(user) = UCase(cursong.lyricarray(lcount)) Then
scorer.score(lcount) = (100 * Len(cursong.lyricarray(lcount))) + 500 ' perfect bonus
scorer.grade(lcount) = "1"
'compare per letter
For p As Integer = 1 To Len(cursong.lyricarray(lcount))
If Right(Left(user,p),1) = Right(Left(cursong.lyricarray(lcount),p),1) Then
scorer.score(lcount)+ = 100
scorer.grade(lcount) = Str( (scorer.score(lcount)/100)/Len(cursong.lyricarray(lcount)))
user = ""
Now this will obviously match perfect matches. But here are some cases and what I'd like to happen:
cursong.lyricarray(lcount) = "concession"
user = "concession"
100% match: This works in my code
user = "condfsdfds"
40% match: this works in my code
user = "conchghession"
100% match, but I would add a penalty for the extra letters: This does not work in my code
user = "codfdsncesfdsfdikosn"
100% match again, - big penalty for extra letters: this does not work in my code
user = "confgfession"
90% match, this one I have no idea how to catch, explained below
So I know how to get the first two cases, for case three and four, I could just check for each letter in order, discarding incorrect ones. But for case 5, there is no second C, so that would not produce the output I want. Sorry to ask this again, but I am just not following this one hehe.