HTML and CSS Reference
In-Depth Information
if(this.currentGuesses[i]) {
status += " " + this.currentWord[i];
} else {
status += " _"
}
}
this.sendTweet(status);
};
this.sendExistingGuess = function(tweeter,guess) {
this.sendTweet("@" + tweeter + ' Sorry someone has already guessed
"' +
guess + '"');
};
this.sendIncorrect = function(tweeter,guess) {
var extra = this.guessesRemaining <= 0 ?
" - Game Over (Word was " + this.word + ")" : ""
this.sendTweet("@" + tweeter + ' sorry there are no ' +
guess + "'s in game " + this.gameNumber + extra);
};
this.sendCorrect = function(tweeter,guess,correct) {
var extra = this.lettersRemaining == 0 ?
“ - Congratulations you win!” : ""
this.sendTweet("@" + tweeter + ' yes, ' + guess + " appears " +
correct + (correct > 1 ? " times" : " time") +
" in game " + this.gameNumber + extra);
};
this.handleGuess = function(tweet) {
if(!tweet.text) return;
var guess = tweet.text.replace(/[^a-z]/gi,""),
tweeter = tweet.user.screen_name,
correct = 0;
try {
if(tweet.text.indexOf("@" + accountName) === 0) {
guess = guess[guess.length-1].toLowerCase();
if(this.guesses.indexOf(guess) != -1) {
return this.sendExistingGuess(tweeter,guess);
}
this.guesses.push(guess);
for(var letter=0;letter < this.currentWord.length;letter++) {
if(this.currentWord[letter].toLowerCase() == guess) {
correct++;
this.lettersRemaining~DH;
this.currentGuesses[letter] = true;
}
}
if(correct > 0) {
Search WWH ::




Custom Search