How do I compare text within % error ?

0 favourites
  • 6 posts
From the Asset Store
7 Errors
$15 USD
7 Errors is a game where you have to find the 7 mistakes before time runs out. Can you find all 7? Have fun looking.
  • i need to compare the input of a text with the correct answer.

    let's say Matrix is the correct answer

    the user is entering matrixe

    how can i say that this answer is good accepting a degre of tipping faults ?

  • Well.... that's a whole question in itself. It really depends how far down the line you want to go. Perhaps something like, for each character in the correct answer, find the nearest character in the typed answer, work out the character difference and probably raise it by a power 1.5 or something so further away scores increasingly worse. I'd remove all controls, punctuation and case before you test.

  • It really depends how far down the line you want to go.

    Very true..

    The easiest way would probably create the list of common (typing/spelling) mistakes yourself and check that against the answer..

    Otherwise it would consist of checking if the right answer is somewhere in there, by comparing the length of the answer, each letter compared to the right answer, etcetera..

    If you want to go that way you should look at the system-expressions for strings/text..

    I guess you are looking for some kind of implementation of the LevensteinDistance-algorithm..

  • ok, i think i'll use array with variante and errors possiblities, it looks less complicate for me.

    thanks

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • An example of levenshtein distance in C2:

  • i have to understand how you did that it looks really nice!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)