当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP作的剪包锤游戏

ASP
用ASP编写网络传呼机
用ASP+CSS实现随机背景
ASP下载系统防盗链方法
用ASP编写下载网页中所有资源的程序
Request.ServerVariables应用
解决Asp程序的Server.CreateObject错误
ASP实现TCP端口扫描的方法
源码实例:ASP实现远程保存图片
用ASP+DLL实现WEB方式修改服务器时间
ASP使用MySQL数据库全攻略
ASP+SQL Server构建网页防火墙
教程/ASP 十天学会ASP之第二天
教程/ASP 十天学会ASP之第四天
教程/ASP 十天学会ASP之第五天
教程/ASP 十天学会ASP之第六天
教程/ASP 十天学会ASP之第七天
教程/ASP 十天学会ASP之第八天
教程/ASP 十天学会ASP之第九天
教程/ASP 十天学会ASP之第十天
关于学习ASP和编程的28个观点

ASP作的剪包锤游戏


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 29 ::
收藏到网摘: n/a

<%
'*********************************************
' THIS IS A SIMPLE GAME OF ROCK SCISSORS PAPER
' FEEL FREE TO DO WHATEVER YOU LIKE WITH THIS
' SCRIPT! -IAN S. CARROLL
'*********************************************

'*********************************************
' 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 = "P"
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 Paper = "P"
Dim tempPlayer, tempComputer

If playerChoice = Rock Then

If computerChoice = Scissor Then
%>
<P><CENTER>
<IMG src="/upload/tech/20091103/20091103093253_5b8add2a5d98b1a652ea7fd72d942dac.gif"><BR>
Your ROCK crushed the computer's SCISSORS!"</CENTER>
<%
End If

ElseIf playerChoice = Scissor Then

If computerChoice = Paper Then
%>
<P><CENTER>
<IMG src="/upload/tech/20091103/20091103093253_6aca97005c68f1206823815f66102863.gif"><BR>
Your SCISSORS cut up the computer's PAPER!</CENTER>
<%
End If

ElseIf playerChoice = Paper Then

If computerChoice = Rock Then
%>
<P><CENTER>
<IMG src="/upload/tech/20091103/20091103093254_ea5d2f1c4608232e07d3aa3d998e5135.gif"><BR>
Your PAPER stumped the computer's ROCK!</CENTER>
<%
End If

ElseIf playerChoice = computerChoice Then
%>
<p><CENTER>
<IMG src="/upload/tech/20091103/20091103093255_cee631121c2ec9232f3a2f028ad5c89b.gif"><BR>
We seem to have a tie!</CENTER>
<%
End If


If computerChoice = Rock Then

If playerChoice = Scissor Then
%>
<P><CENTER>
<IMG src="/upload/tech/20091103/20091103093253_5b8add2a5d98b1a652ea7fd72d942dac.gif"><BR>
The computer's ROCK crushed your SCISSORS!</CENTER>
<%
ElseIf playerChoice = computerChoice Then
%>
<P><CENTER>
<IMG src="/upload/tech/20091103/20091103093255_cee631121c2ec9232f3a2f028ad5c89b.gif"><BR>
We seem to have a tie!</CENTER>
<%
End If

ElseIf computerChoice = Scissor Then

If playerChoice = Paper Then
%>
<P><CENTER>
<IMG src="/upload/tech/20091103/20091103093257_1700002963a49da13542e0726b7bb758.gif"><BR>
The computer's SCISSOR cut up your PAPER!</CENTER>
<%
ElseIf playerChoice = computerChoice Then
%>
<P><CENTER>
<IMG src="/upload/tech/20091103/20091103093255_cee631121c2ec9232f3a2f028ad5c89b.gif"><BR>
We seem to have a tie!</CENTER>
<%
End If

ElseIf computerChoice = Paper Then

If playerChoice = Rock Then
%>
<P><CENTER>
<IMG src="/upload/tech/20091103/20091103093254_ea5d2f1c4608232e07d3aa3d998e5135.gif"><BR>
The computer's PAPER stumped your ROCK!</CENTER>
<%

ElseIf playerChoice = computerChoice Then
%>
<P><CENTER>
<IMG src="/upload/tech/20091103/20091103093255_cee631121c2ec9232f3a2f028ad5c89b.gif"><BR>
We seem to have a tie!</CENTER>
<%
End If
ElseIf computerChoice = playerChoice Then
%>
<P><CENTER>
<IMG src="http://www.ruanchen.com/iles/BeyondPic/chinazcj/2005-11/18/0511182238102970"