<%
'Walter 14/6/2001 revived 29/5/2002
if Request.QueryString ("cntCardB") = "" then 'first time initialization
Balance = 100
else 'process previous bet
Balance = Request.QueryString("cntBalance") 'could store in session object
Bet = Request.QueryString("cntBet")
Balance = Balance - Bet 'take bet
b = cdbl(Request.QueryString("cntCardB")) 'if you don't use cdbl some numbers are strings..
c = cdbl(Request.QueryString("cntCardC"))
d = cdbl(Request.QueryString("cntCardD"))
if b > c then 'make b smaller than c
e = b
b = c
c = e
end if
if (d > b) and (d < c) then 'winner
Balance = Balance + Bet + 3 * Bet
Comment = "you won"
else
Comment = "you lost"
end if
end if
'Deal new cards
Randomize
b = dealACard() 'card 1 (this value is used later)
CardB = b & "h.gif" 'determine card to display
c = dealACard() 'card 2
CardC = c & "h.gif"
d = dealACard() 'card 3
'CardD = d & "h.gif" 'doesn't get displayed
function dealACard () 'as integer
dealACard = int(rnd * 13) + 2
end function
%>
Place your bet!
|
<% if Request.QueryString("cntCardB") <> "" then 'there was a previous move %>
<%= Comment & " " & Session("SessionName") %>
<%= " " %> |
<%= " " %> |
<%= " " %> |
The value of your third card was <%= Request.QueryString("cntCardD") %>.
The value of your first card was <%= Request.QueryString("cntCardB") %>
and the value of your second card was <%= Request.QueryString("cntCardC") %>.
|
<% end if %>
Acey Ducey sends the form's fields to itself using the GET method on each Submit.
We read them in with response.querystring("fieldname").
The cards are in /pack 00h.gif through to 13.gif.