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

ASP
用asp执行DTC
利用ADODB.Stream使用浏览器下载服务器文件
应用数据库的唯一性约束并在asp中捕捉数据库的错误
用ASP编程控制在IIS建立Web站点
asp实现k线图(在线)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(7)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(6)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(5)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(4)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(3)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(2)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(1)
用文本+ASP打造新闻发布系统。几点补充
用文本+ASP打造新闻发布系统(五)新闻修改
用文本+ASP打造新闻发布系统(四)新闻删除
用文本+ASP打造新闻发布系统(三)新闻列表显示
用文本+ASP打造新闻发布系统(二)新闻添加
ASP作的剪包锤游戏
ASP注册表项目修改
构建稳定的服务器端组件的七个步骤

ASP作的剪包锤游戏


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