Dim next_cell, num_filled
Dim guessed, answer
Dim blank_page, empty_page, page_header, page_footer
Dim current_string
Dim num_won, num_lost
num_won = 0
num_lost = 0
next_cell = 1
Sub startup
answer = GetWord()
fill_frames Len(answer)
'msgbox(answer)
end sub
sub restart
restore_captions
guessed = ""
next_cell = 1
num_filled = 0
startup
end sub
sub fill_frames(ByVal num_to_fill)
Dim i
Pic.src = "../resources/images/hangman1.gif"
current_string = ""
For i = 1 to Len(answer)
current_string = "_ " & current_string
Next
' writes the underscore characters
ReplaceMe.innerHTML = current_string
ReplaceMe2.innerHTML = "won:  " & num_won & "    lost:  " & num_lost
end sub
sub restore_captions
' use Elements array when its implemented
A.style.visibility = "visible"
B.style.visibility = "visible"
C.style.visibility = "visible"
D.style.visibility = "visible"
E.style.visibility = "visible"
F.style.visibility = "visible"
G.style.visibility = "visible"
H.style.visibility = "visible"
I.style.visibility = "visible"
J.style.visibility = "visible"
K.style.visibility = "visible"
L.style.visibility = "visible"
M.style.visibility = "visible"
N.style.visibility = "visible"
O.style.visibility = "visible"
P.style.visibility = "visible"
Q.style.visibility = "visible"
R.style.visibility = "visible"
S.style.visibility = "visible"
T.style.visibility = "visible"
U.style.visibility = "visible"
V.style.visibility = "visible"
W.style.visibility = "visible"
X.style.visibility = "visible"
Y.style.visibility = "visible"
Z.style.visibility = "visible"
end sub
sub erase_caption (ByVal letter)
' use Elements array when its implemented
Select Case letter
case "a" : A.style.visibility = "hidden"
case "b" : B.style.visibility = "hidden"
case "c" : C.style.visibility = "hidden"
case "d" : D.style.visibility = "hidden"
case "e" : E.style.visibility = "hidden"
case "f" : F.style.visibility = "hidden"
case "g" : G.style.visibility = "hidden"
case "h" : H.style.visibility = "hidden"
case "i" : I.style.visibility = "hidden"
case "j" : J.style.visibility = "hidden"
case "k" : K.style.visibility = "hidden"
case "l" : L.style.visibility = "hidden"
case "m" : M.style.visibility = "hidden"
case "n" : N.style.visibility = "hidden"
case "o" : O.style.visibility = "hidden"
case "p" : P.style.visibility = "hidden"
case "q" : Q.style.visibility = "hidden"
case "r" : R.style.visibility = "hidden"
case "s" : S.style.visibility = "hidden"
case "t" : T.style.visibility = "hidden"
case "u" : U.style.visibility = "hidden"
case "v" : V.style.visibility = "hidden"
case "w" : W.style.visibility = "hidden"
case "x" : X.style.visibility = "hidden"
case "y" : Y.style.visibility = "hidden"
case "z" : Z.style.visibility = "hidden"
End Select
end sub
function return_next_cell()
next_cell = next_cell + 1
return_next_cell = "../resources/images/hangman" & CStr(next_cell) & ".gif"
end function
sub fill_letters (ByVal pos, ByVal letter)
do
if pos = 1 then
current_string = letter & mid(current_string,2)
else
current_string = Left(current_string,(2*pos-2)) & letter & mid(current_string,(2*pos))
end if
num_filled = num_filled + 1
pos = Instr(pos + 1, answer, letter)
Loop Until pos = 0
end sub
sub guess(ByVal letter)
dim pos
If Instr(guessed,letter) Then
Exit Sub
Else
guessed = guessed & letter
erase_caption letter
pos = Instr(answer, letter)
If pos Then
fill_letters pos, letter
If num_filled = Len(answer) Then
end_game 1
Else
ReplaceMe.innerHTML = current_string
end if
Else
Pic.src = return_next_cell
If next_cell = 7 Then
end_game 0
End If
End If
End If
end sub
sub end_game (ByVal winner)
If winner Then
num_won = num_won + 1
ReplaceMe.innerHTML = answer & "
you win!"
else
num_lost = num_lost + 1
ReplaceMe.innerHTML = "you're dead!
(" & answer & ")"
End If
ReplaceMe2.innerHTML = "won:  " & num_won & "    lost:  " & num_lost
guessed = "abcdefghijklmnopqrstuvwxyz"
end sub
function GetWord()
Dim WordList(150), temp_str, coded_word, i
WordList(0) = "bfspcbujd"
WordList(1) = "cbmmjtujd"
WordList(2) = "dibuufm"
WordList(3) = "ebdib"
WordList(4) = "cfkftvt"
WordList(5) = "difssz"
WordList(6) = "bmvnjovn"
WordList(7) = "cfstfsl"
WordList(8) = "divsm"
WordList(9) = "efdbef"
WordList(10) = "cjbmz"
WordList(11) = "dmbqusbq"
WordList(12) = "dpodvcjobhf"
WordList(13) = "efubttfmmfe"
WordList(14) = "btdfujd"
WordList(15) = "dpsejbmmz"
WordList(16) = "epmesvnt"
WordList(17) = "dpvsbhf"
WordList(18) = "epqftu"
WordList(19) = "csbwvsb"
WordList(20) = "dpvuvsf"
WordList(21) = "epzfoof"
WordList(22) = "bvujtn"
WordList(23) = "dvdlpme"
WordList(24) = "esbdpojbo"
WordList(25) = "dbufsxbvm"
WordList(26) = "cbejobhf"
WordList(27) = "dvsnvehfpo"
WordList(28) = "gbssbhp"
WordList(29) = "hbsspuf"
WordList(30) = "ijstvuf"
WordList(31) = "izesphfobufe"
WordList(32) = "fstbu{"
WordList(33) = "fujpmbufe"
WordList(34) = "gsjuufs"
WordList(35) = "jowfjhmf"
WordList(36) = "ibscjohfs"
WordList(37) = "jsbtdjcmf"
WordList(38) = "ifcfubujpo"
WordList(39) = "hbsnfoup"
WordList(40) = "kbnplf"
WordList(41) = "kfsfnjbe"
WordList(42) = "njojpo"
WordList(43) = "nofnpojd"
WordList(44) = "mbdlfz"
WordList(45) = "nfmbodipmjb"
WordList(46) = "mbdpojd"
WordList(47) = "nfoebdjuz"
WordList(48) = "oznqifu"
WordList(49) = "qimfhnz"
WordList(50) = "qvsjubo"
WordList(51) = "obtdfou"
WordList(52) = "pggbm"
WordList(53) = "qjdbzvof"
WordList(54) = "ofccjtiz"
WordList(55) = "qpmusppojti"
WordList(56) = "qbmb{{p"
WordList(57) = "qpttf"
WordList(58) = "ofpsfbmjtn"
WordList(59) = "qptuibtuf"
WordList(60) = "qpucpjmfs"
WordList(61) = "spupujmmfs"
WordList(62) = "qfeboujd"
WordList(63) = "ojooz"
WordList(64) = "qfovmujnbuf"
WordList(65) = "ovodiblvt"
WordList(66) = "qibmboy"
WordList(67) = "qsphfoz"
WordList(68) = "svuimftt"
WordList(69) = "tmbti"
WordList(70) = "tvggsbhfuuf"
WordList(71) = "usphmpezuf"
WordList(72) = "utvobnj"
WordList(73) = "toppe"
WordList(74) = "uvsffo"
WordList(75) = "tpnnfmjfs"
WordList(76) = "voduvpvt"
WordList(77) = "tufbl"
WordList(78) = "wjdjttjuvef"
WordList(79) = "tibncmjoh"
WordList(80) = "xbtusfm"
WordList(81) = "ubxesz"
WordList(82) = "tisjgu"
WordList(83) = "ufsnbhbou"
WordList(84) = "yfopqipcf"
WordList(85) = "tlvmmevhhfsz"
WordList(86) = "tmbdlfs"
WordList(87) = "hmjnnfs"
WordList(88) = "mjuif"
WordList(89) = "bcsbef"
WordList(90) = "befqu"
WordList(91) = "bmmpz"
WordList(92) = "bobmph"
WordList(93) = "bqqbmmjoh"
WordList(94) = "bssbz"
WordList(95) = "btusjohfodz"
WordList(96) = "cfesbhhmfe"
WordList(97) = "dfousjqfubm"
WordList(98) = "dpnqbujcmf"
WordList(99) = "efdfmfsbuf"
WordList(100) = "efdfmfsbuf"
WordList(101) = "ejbefn"
WordList(102) = "ejwvmhf"
WordList(103) = "fspef"
WordList(104) = "fyusjotjd"
WordList(105) = "gpscfbs"
WordList(106) = "gvmtpnf"
WordList(107) = "hmvuupopvt"
WordList(108) = "jejpnbujd"
WordList(109) = "jogmbufe"
WordList(110) = "joufhsbuf"
WordList(111) = "kbvouz"
WordList(112) = "ljtnfu"
WordList(113) = "mbdisznptf"
WordList(114) = "mjcfsujof"
WordList(115) = "nbvwf"
WordList(116) = "njovujbf"
WordList(117) = "obubujpo"
WordList(118) = "ojswbob"
WordList(119) = "qboefnjd"
WordList(120) = "qmvnnfu"
WordList(121) = "qsjtujof"
WordList(122) = "qspnpoupsz"
WordList(123) = "qtjpojd"
WordList(124) = "qvsqpsu"
WordList(125) = "rvbssz"
WordList(126) = "sfbmn"
WordList(127) = "sfdfttjpobsz"
WordList(128) = "sfnvofsbujwf"
WordList(129) = "sftjmjfou"
WordList(130) = "sptfbuf"
WordList(131) = "tbdsjmfhf"
WordList(132) = "tdpgg"
WordList(133) = "tqbujbm"
WordList(134) = "tqvsjpvt"
WordList(135) = "tusbuvn"
WordList(136) = "tuznjf"
WordList(137) = "tvmmz"
WordList(138) = "tvqfsgjdjbm"
WordList(139) = "uboubmj{f"
WordList(140) = "ujuif"
WordList(141) = "usbotdfoe"
WordList(142) = "voduvpvt"
WordList(143) = "vtvsqbujpo"
WordList(144) = "wbohvbse"
WordList(145) = "wjujbuf"
WordList(146) = "wpmbujmjuz"
WordList(147) = "xbssbou"
WordList(148) = "xsbohmf"
WordList(149) = "yfopqipcf"
WordList(150) = "{fjuhfjtu"
Randomize
coded_word = WordList(Int(Rnd*151))
For i = 1 To Len(coded_word)
temp_str = temp_str & Chr(Asc(Mid(coded_word, i, 1)) - 1)
Next
GetWord = temp_str
end function