1 Replies - 2059 Views - Last Post: 05 January 2007 - 05:56 AM Rate Topic: -----

#1 skydrove  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-January 07

Hangman Logic Needed

Posted 04 January 2007 - 10:39 PM

I need help for my hangman application to be shown on a cisco ip phone emulator.

These are the following codes of one the main page.
<%@ Language=VBScript %>
<%
Response.ContentType = "text/xml"
Response.Buffer = true
%>

<%
mWord = Request.QueryString("mWord")
level = Request.QueryString("varLevel")
chance = Request.QueryString("chance")
charsUsed = Request.QueryString("charsUsed")
charSelected = Request.QueryString("charSelected")

'check if user input character is inside the WORD? replace the '-' with the character input

	charsUsedArr = Split(charsused, ",")

	if instr(UCase(mWord), UCase(charSelected)) > 0 then		
				
		If Instr(UCase(mWord), UCase(charSelected)) = 0 then
			chance = chance - 1
		End if
	else
		For i = 1 to Len(mWord)
			mWordShow = mWordShow & "_ "
		next
	end if		

	if charsUsed = "" then
		charsUsed = charSelected
	else
		charsUsed = charsUsed & ", " & charSelected
	end if	

		'mWordShow = "--a--a"

		'check for end of game
	endOfGame = false		
	If Instr(mWordShow, "_") = 0 then
		endOfGame = true
	End if
	if chance = 0 then
		endOfGame = true
	end if
%>

<CiscoIPPhoneText>
	<Title>Hangman(Word-guessing application)</Title>
	<Prompt></Prompt>
	<%if endOfGame = true then%>
		<Text>You have completed the game</Text>
		<% 2 conditions%>
		<% whether they finish all the chances but fail to guess%>
		
		<%
		if chance = 0 and  Instr(mWordShow, "_") > 0 then
		Response.write "You have finished all your chances and fail to complete the puzzle"
		end if
		%>	
	
		<% whether they manage to guess without finishing all the chances%>
		
		<%
		if chance < 0 and Instr(mWordShow, "_") = 0 then
		Response.write "You managed to solve the puzzle"
		end if
		
		%>
		<SoftKeyItem>
			<Name>Restart</Name>
			<URL>SoftKey:Select</URL>
			<Position>2</Position>
		</SoftKeyItem>
		<SoftKeyItem> 
			<Name>Option</Name>
			<URL>SoftKey:Select</URL>
			<Position>3</Position>
		</SoftKeyItem>
	<%else%>		
		<Text>Guess this word (level:<%=level%>)</Text>
		<Text><%=mWordShow%></Text>
		<Text>Chances: <%=chance%></Text>
		<Text>Chars used:("UCase(charsUsed)")</Text>
		<SoftKeyItem>
			<Name>Guess</Name>
			<URL>http://172.20.131.164/Hangman/Enter.asp?word=<%=word%>&chance=<%=chance%>&level=<%=level%>&charsused=<%=charsused%></URL>
			<Position>1</Position>
		</SoftKeyItem>
		<SoftKeyItem>
			<Name>Restart</Name>
			<URL>SoftKey:Select</URL>
			<Position>2</Position>
		</SoftKeyItem>
		<SoftKeyItem> 
			<Name>Option</Name>
			<URL>SoftKey:Select</URL>
			<Position>3</Position>
		</SoftKeyItem>
		<SoftKeyItem>
			<Name>Exit</Name>
			<URL>SoftKey:Exit</URL>
			<Position>4</Position>
		</SoftKeyItem>
	<%end if%>
</CiscoIPPhoneText>
<%
Response.Flush()
Response.End()
%>


Is This A Good Question/Topic? 0
  • +

Replies To: Hangman Logic Needed

#2 m2s87  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 21
  • View blog
  • Posts: 390
  • Joined: 28-November 06

Re: Hangman Logic Needed

Posted 05 January 2007 - 05:56 AM

Can you explain the problem?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1