How do I compare text within % error ?

0 favourites
  • 6 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • 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

  • An example of levenshtein distance in C2:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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)