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

ASP
ASP中数据库调用中常见错误的现象和解决方法
ASP取出HTML里面的图片地址的函数
关于分页查询和性能问题
利用Asp生成整站静态
用ASP+XMLHTTP编写一个天气预报程序
轻松检测浏览器是否接受Cookies信息
净化网络环境:ASP程序实现过滤脏话
入门:防范SQL注入攻击的新办法
如何对ASP.NET进行性能优化
ASP无法更新ACCESS数据库解决方法
ASP:利用ASP把图片上传到数据库
ASP:用ASP编程实现网络内容快速查找
ASP:用ASP打造一个小型的网页BBS系统
ASP:用Asp编程实现QQ的在线情况查询
通过表单创建word的一个例子
在ASP中轻松实现记录集分页显示
ASP中实现小偷程序的原理和简单示例
ASP:6行代码实现无组件上传
实用篇:用asp实现QQ在线查询
如何轻松打造ASP计数器

ASP作的剪包锤游戏


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 25 ::
收藏到网摘: 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"