Blackjack task in E-prime

Adele adele.dimian at gmail.com
Tue May 4 19:45:56 UTC 2010


Hello all,

We are currently trying to program a Blackjack task in e-prime and
have been trying unsuccessfully for months now! The problem we are
having has to do with how to calculate the value of each card so we
can then calculate the total value of the dealer and participant's
hands. We are trying to use an array to declare the value of the cards
(bear with us this is our first time attempting to use an array). The
cards are set up in a blocklist with card values. In theory  we would
like to draw from this list to declare the values, so that the values
are consistent with the cards dealt.

Once the card values are declared we then would like to use an
equation to add the card values and compare the participant total card
value to the dealer card value. We need the dealer card value to
program when the dealer hits and stays.

Please see below, can anyone point us in the right direction? We would
appreciate it immensely! Thanks for your time and consideration.

Kind regards,
Adele and Brittany


Please excuse our inexperience and disorganization, here are several
different ways we were trying to get the card values:

'******************>
' CalcNewTotalVal
'******************>
Dim value As Integer
Dim total As Integer
Dim CardCount As Integer
Dim i As Integer
Dim DealerCardCount As Integer
Dim PlayerCardCount As Integer
Dim Deck As clsDeck
Dim hit as integer
Dim stay as Integer
Dim playercardtotal as integer
Dim Dealercardtotal as integer
Dim won as currency
Dim lost as currency
dim winnings as currency

Dim arrValue (10) as integer

For i = 0
'c.SetAttrib "Won", "Won"
'c.SetAttrib "Lost", "Lost"
'won = val(c.getattrib("Won"))
'lost = val(c.getattrib("Lost"))
total = total + won - lost
winnings = total - val(c.getattrib("borrowed"))

'c.SetAttrib "Hit", "Hit"
'c.SetAttrib "Stay", "Stay"
'Hit = val(c.getattrib("Hit"))
'Stay = val(c.getattrib("Stay"))
'c.getattrib("ValBC1")
'c.getattrib("ValSC")
'c.getattrib("ValHit1")
'c.getattrib("ValHit2")
'c.getattrib("ValDBC1")
'c.getattrib("ValDSC")
'c.getattrib("ValDHit1")
'c.getattrib("ValDHit2")
Playercardtotal = "ValBC1" + "ValSC" + "ValHit1" + "ValHit2"
Dealercardtotal = "ValDBC1" + "ValDSC" + "ValDHit1" + "ValDHit2"
winnings = total - val(c.getattrib("borrowed"))

If Playercardtotal > 21 Then
   MsgBox "You busted"
   goto EndlabelDealerif2
End If

'For DealerTotal = GetCardTotal(Dealer)
If DealerCardTotal > 21 Then
   MsgBox "Dealer busts"
ElseIf DealerCardTotal > 15 Then
   MsgBox "Dealer stays"
'   EndGame
'Else
 '  DealerCardCount = DealerCardCount + 1
  ' Deck.Deal 1, Dealer, _
   '  DealerCardCount * 80 + 20, 60, 0, FaceUp
End If


'total = 0
'CardCount = Choice1.NumCardsInHand(plyer)
'For i = 0 To CardCount - 1
'	value = Choice1.GetCardValue(plyer, i) Mod 13
'	total = total + value + 1




'Dim msg As String

'Deck.ShowHandCard Dealer, 0, FaceUp
'DealerCardTotal = GetCardTotal(Dealer)
'PlayerCardTotal = GetCardTotal(Player)
Set Choice1 = Nothing

'msg = "Dealer: " + CStr(DealerCardTotal) + _
'	 + "Player: " + CStr(PlayerCardTotal)
If PlayerCardTotal > 21 Or (PlayerCardTotal < DealerCardTotal And
DealerCardTotal < 22) then
MsgBox "You lose."
Elseif PlayerCardTotal < 21 Or (PlayerCardTotal > DealerCardTotal And
DealerCardTotal > 22) then
msgBox "You win."
End If

debug.print "won " & c.getattrib("won")

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list