📄 stonegame.asp
字号:
<%
Response.Buffer=true
Response.Expires=0
Response.ContentType ="text/vnd.wap.wml"
response.write("<?xml version=""1.0"" encoding=""gb2312""?>")
response.write("<!DOCTYPE wml PUBLIC ""-//WAPFORUM//DTD WML 1.1//EN"" ""http://www.wapforum.org/DTD/wml_1.1.xml"">")
response.write("<!-- Source Generated by WML Deck Decoder -->")
dim message,flag
'*********************************************
' THIS FUNCTION GENERATES A RANDOM NUMBER
'*********************************************
Function computerChooses()
Dim randomNum
Dim choice
randomize
randomNum = int(rnd*15)+1
If randomNum = 1 OR randomNum = 3 OR randomNum = 7 OR randomNum = 8 OR randomNum = 15 OR randomNum = 12 Then
choice = "R"
ElseIf randomNum = 2 OR randomNum = 6 OR randomNum = 11 OR randomNum = 13 Then
choice = "S"
Else
choice = "C"
End If
computerChooses = choice
End Function
'*********************************************
' THIS FUNCTION SIMPLY DETERMINES THE WINNER
' OF THE GAME
'*********************************************
Sub determineWinner(playerChoice, computerChoice)
Const Rock = "R"
Const Scissor = "S"
Const cloth = "C"
Dim tempPlayer, tempComputer
If playerChoice = Rock Then
If computerChoice = Scissor Then
' message="呜呜,你的<img src=""../../images/R_c1.jpg"" alt=""石头""/>砸了我的<img src=""../../images/S_y1.jpg"" alt=""剪子""/>"
message="玩家<img src=""../../images/R_c1.jpg"" alt=""石头""/>VS机器<img src=""../../images/S_y1.jpg"" alt=""剪子""/><br/>哇,你赢了"
flag=1
End If
ElseIf playerChoice = Scissor Then
If computerChoice = cloth Then
' message="呜呜,你的<img src=""../../images/S_y1.jpg"" alt=""剪子""/>绞了我的<img src=""../../images/P_s1.jpg"" alt=""布""/>"
message="玩家<img src=""../../images/S_y1.jpg"" alt=""剪子""/>VS机器<img src=""../../images/P_s1.jpg"" alt=""布""/><br/>哇,你赢了"
flag=1
End If
ElseIf playerChoice = cloth Then
If computerChoice = Rock Then
' message="呜呜,你的<img src=""../../images/P_s1.jpg"" alt=""布""/>包了我的<img src=""../../images/R_c1.jpg"" alt=""石头""/>"
message="玩家<img src=""../../images/P_s1.jpg"" alt=""布""/>VS机器<img src=""../../images/R_c1.jpg"" alt=""石头""/><br/>哇,你赢了"
flag=1
End If
ElseIf playerChoice = computerChoice Then
message="噫,打成了平手!"
flag=0
End If
If computerChoice = Rock Then
If playerChoice = Scissor Then
' message="呵呵,我的<img src=""../../images/R_c1.jpg"" alt=""石头""/>砸了你的<img src=""../../images/S_y1.jpg"" alt=""剪子""/>"
message="玩家<img src=""../../images/S_y1.jpg"" alt=""剪子""/>VS机器<img src=""../../images/R_c1.jpg"" alt=""石头""/><br/>哦,我赢了"
flag=-1
ElseIf playerChoice = computerChoice Then
message="噫,打成了平手!"
flag=0
End If
ElseIf computerChoice = Scissor Then
If playerChoice = cloth Then
' message="呵呵,我的<img src=""../../images/S_y1.jpg"" alt=""剪子""/>剪了你的<img src=""../../images/P_s1.jpg"" alt=""布""/>"
message="玩家<img src=""../../images/P_s1.jpg"" alt=""布""/>VS机器<img src=""../../images/S_y1.jpg"" alt=""剪子""/><br/>哦,我赢了"
flag=-1
ElseIf playerChoice = computerChoice Then
message="噫,打成了平手!"
flag=0
End If
ElseIf computerChoice = cloth Then
If playerChoice = Rock Then
' message="哈哈,我的<img src=""../../images/P_s1.jpg"" alt=""布""/>包了你的<img src=""../../images/R_c1.jpg"" alt=""石头""/>"
message="玩家<img src=""../../images/R_c1.jpg"" alt=""石头""/>VS机器<img src=""../../images/P_s1.jpg"" alt=""布""/><br/>哦,我赢了"
flag=-1
ElseIf playerChoice = computerChoice Then
message="噫,打成了平手!"
flag=0
End If
ElseIf computerChoice = playerChoice Then
message="噫,打成了平手!"
flag=0
End If
End Sub
sub gameover()
%>
<br/>
<a href="stonegame.asp">再玩</a><br/>
<a href="selectgo.asp">选择游戏</a><br/>
<a href="../index.asp">回到主页</a>
<%
end sub
'*********************************************
'*
'* 主函数
'*
'*********************************************
'变量定义
Dim player, computer
Dim gameAction,querystring,options
Dim Text,lastscore,playername
'参数传递
Text=Request.QueryString("name")
options = Request.QueryString("choice")
'*********************************************
' THIS FUNCTION WILL CAUSE THE GAME TO
' EXECUTE UNLESS A DIFFERENT ACTION WAS CHOSEN
'*********************************************
'这个函数的修改比较繁:
Sub playGame()
%>
<do type="accept" label="确定">
<prev/>
</do>
请选择: <br/>
<a href="stonegame.asp?choice=R;">石头</a><br/>
<a href="stonegame.asp?choice=S;">剪子</a><br/>
<a href="stonegame.asp?choice=C;">布</a><br/>
<a href="selectgo.asp">选择游戏</a><br/>
<a href="../index.asp">论坛主页</a>
<%
End Sub
%>
<wml>
<head>
<meta http-equiv="Cache-control" content="no-cache"
forua= "true" />
</head>
<card title="石头剪子布">
<p>
<%
if options="" then
playgame
else
querystring=split(options,";")
gameaction=querystring(0)
select case gameAction
case "R" , "S" , "C"
player = gameAction
computer = computerChooses
determineWinner player, computer
Response.Write message
' if flag=-1 then
gameover
' else
' playAgain
' end if
' playgame
End select
End if
%>
</p>
</card>
</wml>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -