var hangmanNumWrong; // num letters wrong var hangmanNumRight; // num letters right var hangmanGuesses; var hangmanWord; var hangmanHint; var hangmanImage ; var hangmanTable ; var scoreTable ; var maxLength = 20; var guessInputDiv ; var youWonDiv; var playAgainDiv ; var curGuess ; var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var punctuation = ".,|();: <>[]{}!@#$%^&*_-+=~`/?'"; var newWord = ""; var newHint =""; var newRow=""; var newCol=""; var newFillInTheBlank; var theTable; var category; var next_word = 0; var wordsFound = 0; var hintButton; var playAgainButton; var categoryCell; var gameCount = 0; var correctCount = 0; function focusOnObject( obj ) { if ( obj ) { if ( obj.focus ) { obj.focus(); } } } var LET_A = "A"; var LET_B = "B"; var LET_C = "C"; var LET_D = "D"; var LET_E = "E"; var LET_F = "F"; var LET_G = "G"; var LET_H = "H"; var LET_I = "I"; var LET_J = "J"; var LET_K = "K"; var LET_L = "L"; var LET_M = "M"; var LET_N = "N"; var LET_O = "O"; var LET_P = "P"; var LET_Q = "Q"; var LET_R = "R"; var LET_S = "S"; var LET_T = "T"; var LET_U = "U"; var LET_V = "V"; var LET_W = "W"; var LET_X = "X"; var LET_Y = "Y"; var LET_Z = "Z"; function processKey( e ) { var key; var letter; if (window.event) key = window.event.keyCode; else if (e) key = e.which; else return true; if ( key >= 97 && key <= 122 ) letter = letters.charAt( key-97 ); else if ( key >=65 && key <= 90 ) letter = letters.charAt( key - 65 ); else return true; chooseLetter( letter ); focusOnObject( hintButton ); return false; } function loadHangMan() { var i; hangmanImage = document.getElementById( "hangManImage" ); hangmanTable = document.getElementById( "hangManTable" ); scoreTable = document.getElementById( "scoreTable" ); guessInputDiv = document.getElementById( "guessInput" ); youWonDiv = document.getElementById( "youWon" ); playAgainDiv = document.getElementById( "playAgain" ); hintButton = document.getElementById( "hintButton" ); playAgainButton = document.getElementById( "playAgainButton" ); theTable = document.getElementById( 'theTable' ); var categoryTable = document.getElementById( "categoryTable" ); categoryCell = categoryTable.rows[0].cells.item(0); hangmanImage.src="http://www.studystack.com/images/HangMan.png"; hangmanImage.src="http://www.studystack.com/images/HangMan6.png"; hangmanImage.src="http://www.studystack.com/images/HangMan5.png"; hangmanImage.src="http://www.studystack.com/images/HangMan4.png"; hangmanImage.src="http://www.studystack.com/images/HangMan3.png"; hangmanImage.src="http://www.studystack.com/images/HangMan2.png"; hangmanImage.src="http://www.studystack.com/images/HangMan1.png"; hangmanImage.src="http://www.studystack.com/images/HangMan0.png"; hangmanNumWrong = 0; hangmanNumRight = 0; hangmanGuesses = ""; getNextWord(); hangmanWord = newWord; hangmanWord = hangmanWord.toUpperCase(); hangmanHint = newHint; showHint( "" ); if ( newCol >= 0 ) { category = theTable.rows[0].cells.item( newCol ).childNodes[0].nodeValue ; categoryCell.childNodes[0].nodeValue = 'Category: ' + category ; } for ( i=0; i= 0 ) { fillBlank( i, "_" ); } else { fillBlank( i, letter ); } } for ( i=hangmanWord.length; i= 0 ) return ; if ( hangmanWord.indexOf( letter ) < 0 ) { hangmanGuesses += letter ; if ( hangmanNumWrong < 6 ) { hangmanNumWrong ++ ; hangmanImage.src = "http://www.studystack.com/images/HangMan" + hangmanNumWrong + ".png" ; if ( hangmanNumWrong == 6 ) { setTimeout( 'youLose()', 500 ); } } } else { showLetter( letter ); if ( hangmanNumRight == hangmanWord.length ) { youWin(); } } } function showLetter( letter ) { hangmanGuesses += letter ; var pos=0; while ( (pos = hangmanWord.indexOf( letter, pos )) >= 0 ) { fillBlank( pos, letter ); pos++; } } function fillBlank( blankNumber, value ) { var aRow = hangmanTable.rows[0]; var cell = aRow.cells.item(blankNumber); if ( cell ) { if ( value == '' ) propertyValue = ""; else if ( value == '_' ) propertyValue = "__"; else { hangmanNumRight ++; propertyValue = value; } cell.childNodes[0].nodeValue = propertyValue ; } } function Shuffle() { var aRow; var bRow; var i; var tableLength = theTable.rows.length; for ( i=1; i=0 ) { count ++; } } return count ; } function LoadWords() { Shuffle(); var wordTable = document.getElementById( 'wordTable' ); var aRow; var i; var tableLength = theTable.rows.length; var maxWords = wordTable.rows.length ; var numColumns = theTable.rows[0].cells.length; var headingRow = theTable.rows[0]; if ( maxWords > 20 ) maxWords = 20; wordsFound = 0; // loop through the rows for ( i=1; i=4 && value.substring(0,7) != "(blank)" ) { // use the whole value foundOne = true ; word = value ; if ( numColumns > 1 ) { hc = (c+1) % numColumns ; aCell = aRow.cells.item(hc); var headingCell = headingRow.cells.item(hc); hint = headingCell.childNodes[0].nodeValue + ": " + aCell.childNodes[0].nodeValue ; } } } else if ( value.indexOf( "__" ) == -1 ) { // look for a long word within this value var pos = Math.floor( Math.random() * valueLength - maxLength ); while ( pos>=0 && pos < valueLength && !foundOne ) { pos = value.indexOf( ' ', pos ); if ( pos >= 0 ) { var start = pos + 1 ; var end pos = value.indexOf( ' ', start ); end = ( pos < 0 ) ? valueLength : pos ; if ( end - start > 5 ) { word = value.substring( start, end ); if ( numLetters( word ) > 5 ) { foundOne = true ; fillInTheBlank = true; // trim leading punctuation while (punctuation.indexOf(word.charAt(0))>=0) { word = word.substring(1); start ++ ; } // trim trailing punctuation while (punctuation.indexOf(word.charAt(word.length - 1))>=0) { word = word.substring(0, word.length-1 ); end--; } hint = value.substring( 0, start) + "_____" + value.substring( end, valueLength ); } } pos = end + 1; } } // end while } // end else if ( foundOne ) { // check that this value isn't already in the table of values for ( f=0; f= wordsFound ) { LoadWords(); next_word = 0; } if ( next_word >= wordsFound ) { newWord = "construction" ; newHint = "under _____" ; newRow = -1; newCol = -1; newFillInTheBlank = false; } else { var row = wordTable.rows[ next_word ] ; newWord = row.cells.item(0).childNodes[0].nodeValue; newHint = row.cells.item(1).childNodes[0].nodeValue; newRow = row.cells.item(2).childNodes[0].nodeValue; newCol = parseInt( row.cells.item(3).childNodes[0].nodeValue ); newFillInTheBlank = row.cells.item(4).childNodes[0].nodeValue; } next_word ++; } if ( document.getElementsByName( "theTable" ).length == 0 ) { document.writeln( '
' ); document.writeln( '' ); document.writeln( '
'); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( '

Stack #49916 Hangman

 
'); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( '
'); document.writeln( ' '); document.writeln( ' '); document.writeln( '
'); document.writeln( ' '); document.writeln( ' '); document.writeln( '
'); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( '
'); document.writeln( '
'); document.writeln( ' '); document.writeln( ' '); document.writeln( '
'); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( '
                    
                                                                                                    
'); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( '
'); document.writeln( '   '); document.writeln( '
'); document.writeln( '
'); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( '
'); document.writeln( '   '); document.writeln( '
'); document.writeln( '
'); document.writeln( ' '); document.writeln( ' '); document.writeln(' ');document.writeln(' '); document.writeln( ' '); document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln('');document.writeln('');document.writeln(' ');document.writeln(' ');document.writeln(''); document.writeln( '
WordDefinition
zealot  n. fanatic; person who shows excessive zeal. The Glenn was devout, he was no zealot; he nver tried to force his religious beliefs on his friends.  
whimsical  n. capricious; fanciful. In Mrs. Doubtfire, the hero i s a plyful, whimsical man who take a notion to dress up as a woman so that he can look after his children, who are in the custody of his ex-wife.  
welter  n. turmoil; bewildering jumble. The existing welter of overlapping federal and state proclaims cries out for immediate reform.  
wary  adj. very cautious. The spies grew wary as they approached the sentry.  
warranty  n. gaurantee; assurance by seller. The purchaser of this automobile is protected by the manufacturer\'s warranty that he will replace any defective part for five years of 50,000 miles.  
warranted  adj. justified; authorized. Before the judge issues the injunction, you must convince her this action is warranted.  
volatile  adj. changeable; explosive; evaporating rapidlly. The political climate today is extremely volatile: no one can predict what the electorate will do next.  
volition  n. act of making a conscious choise. She selected this dress of her own volition.  
vituperative  adj. abusive; scolding. he became more vituperative as he realized that we were not going to grant him his wish.  
viscous  adj. sticky, gluey. Melted tar is a viscous substance.  
viable  adj. practical or workable; capable of maintaing life.  
verbose  adj. wordy. We had to make some major cuts in Senator Foghorn\'s speech because i was far too verbose.  
veracious  adj. truthful. I can recommend him for this position because I have always found him veracious and reliable.  
venerate  v. revere. In Tiber today, the common people still venerate their traditional spiritual leader, the Dalai Lama.  
vacillate  v. waver; fluctuate. Uncertain which suitor she ought to marry, the princess vacillated, saying now one, no the other.  
trucelence  n. aggressiveness; ferocity. Tynan\'s reviews were noted for their caustic attacks and general tone of trucelence.  
transfrewssion  n. violation of a law; sing. Although Widow Douglass was willing to overlook Huck\'s min  
'); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( ' '); document.writeln( '
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
'); document.writeln( '
'); document.writeln( ' '); loadHangMan(); } // end if documents.getElementsByName( 'theTable' ).length == 0