<?xml version="1.0" encoding="windows-1252"?>
<node id="998860" title="Simple Blackjack progam help" created="2012-10-13 13:10:27" updated="2012-10-13 13:10:27">
<type id="115">
perlquestion</type>
<author id="998086">
ria1328</author>
<data>
<field name="doctext">
&lt;p&gt; I'm having some trouble with this program. We're supposed to create a program with subroutines for Blackjack. The requirements are:





Deck (1-10) Random Numbers; Plaver vs. Dealer; Bank (Sufficient Funds); Draw on 16; Stick on 17; 21 Wins; Dealer wins all ties; Calculate Funds available; Play until you want to quit or "Go bust"; Contains one or more subroutines 

I've never played Blackjack before so I'm more than a little confused. Here's my code:&lt;/p&gt;
&lt;code&gt; #!/usr/bin/perl


srand;

print "How much money are you playing?";
$total = &lt;STDIN&gt;;
print "What is your bet? ";
$bet = &lt;STDIN&gt;;
print "Here's your first card: ";
$draw1 = int &amp;draw; 
print $draw1;
print "\nDealer has ";
$dDraw = int &amp;draw;
print "\n $dDraw";

print "Would you like another card? y/n";
$another = &lt;STDIN&gt;;

if ($another == 'y')    
{
  do{
  $count = 2; 
  print "You're $count card is: \n";
  $draw2 = int &amp;draw;
  print $draw2;
  print "Dealer has ";
  $dDraw = int &amp;draw;
  print "$dDraw ";
  $count ++;
  $total = $draw1 + $draw2;

  print "\nWould you like another card? y/n";
  $another = &lt;STDIN&gt;;
  
  }while ($total&gt;0 &amp;&amp; $another == 'y');
}
else {if ($another == 'n')
  { print "$draw1 $draw2 ";}}


sub draw {
  $draw = int rand(10);
}

 &lt;/code&gt;

&lt;p&gt;First, I'm getting stuck in an infinite loop in the if/dowhile part. I also can't figure out a way to count the cards up for both dealer and player and to calculate funds available. Any help?&lt;/p&gt;</field>
</data>
</node>
