Reprint an ASP to cut the bag hammer game

Source: Internet
Author: User
<%
'*********************************************
' This is A simple GAME of the rock SCISSORS PAPER
' FEEL free to do WHATEVER '
' 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 = or Randomnum = a Then
Choice = "R"
ElseIf Randomnum = 2 or Randomnum = 6 or randomnum = one or Randomnum = Then
Choice = "S"
Else
Choice = "P"
End If

computerchooses = Choice
End Function



'*********************************************
' This FUNCTION SIMPLY determines the WINNER
' 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>
<BR>
Your Rock crushed the computer ' s scissors! </CENTER>
<%
End If

ElseIf Playerchoice = Scissor Then

If Computerchoice = Paper Then
%>
<P><CENTER>
<BR>
Your SCISSORS cut up the computer ' s paper!</center>
<%
End If

ElseIf Playerchoice = Paper Then

If Computerchoice = Rock Then
%>
<P><CENTER>
<BR>
Your PAPER stumped the computer ' s rock!</center>
<%
End If

ElseIf Playerchoice = Computerchoice Then
%>
<p><CENTER>
<BR>
We seem to have a tie!</center>
<%
End If


If Computerchoice = Rock Then

If Playerchoice = Scissor Then
&nb



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.