Skip to content
Aditya edited this page Oct 5, 2013 · 1 revision

**SwiftTyper Algorithm**

This section contains the various functions and variables and the algorithm description for
accepting the strings from user and matching it with the paragraph.

  • The string to be typed is stored in a string variable paragraph. A function updatecurrentWordFromPara() returns the next word to be typed by the user from the 'paragraph' variable and stored it in currentWordFromPara.

* The text field provided for taking input string from user is connected to and onchange function named **onChanged()** which takes the input from user and stores in variable **userInputWord**. The words **userInputWord** and **currentWordFromPara** are matched in this function to find out if the initial characters of **currentWordFromPara** are equivalent to the characters in **userInputWord**.

* When space is detected in the end by the **onChanged()**, it checks for equality of both variables and if they are equal, the text field is cleared and **updatecurrentWordFromPara()** is called. This is done until the same function does not detect an end of **paragraph**.
Clone this wiki locally