Hangman Script Tutorialpage three |
|
More of this FeaturePage One Page Two Page Four Page Five Page Six Page Seven Page Eight
var al = '--------------------------';
if (qsParm['al']) al = qsParm['al']; This string field is initialised to 26 dashes. As guesses are made the appropriate letters of the alphabet will be substituted. This serves both to keep track of which letters have already been guessed as well as to simplify the display of the answer field.
var wr = 'xhwdarqpnez';
var dc = '7!3@4#1$^5*~:6 +8=`<2-0>_/?9'; var wx = 0; if (qsParm['w']) wx = wr.indexOf(qsParm['w']); The wr field serves to encrypt the counter that keeps track of how many wrong guesses have been made so far while the dc field serves as an encryption table for the answer array. The indexOf method is used on the wr string to locate the position of the retrieved w parameter. That position indicates the number of wrong guesses made so far. |

