I've wanted to make a cards game but I've been stack in the middle of the project let me show you the code first:
Code: Select all
<?php
echo "<center>Computer: <br>";
for($x=1;$x<14;$x++)
echo "<img src='images/fold.png' border='1' />";
$cards=array(
"<img src='images/2.png' width='84' height='129' border='1' />",
"<img src='images/3.png' width='84' height='129' border='1' />",
"<img src='images/4.png' width='84' height='129' border='1' />",
"<img src='images/5.png' width='84' height='129' border='1' />",
"<img src='images/6.png' width='84' height='129' border='1' />",
"<img src='images/7.png' width='84' height='129' border='1' />",
"<img src='images/8.png' width='84' height='129' border='1' />",
"<img src='images/9.png' width='84' height='129' border='1' />",
"<img src='images/10.png' width='84' height='129' border='1' />",
"<img src='images/J.png' width='84' height='129' border='1' />",
"<img src='images/Q.png' width='84' height='129' border='1' />",
"<img src='images/K.png' width='84' height='129' border='1' />",
"<img src='images/A.png' width='84' height='129' border='1' />");
echo "<br><br><br><br><br><br>";
$rndflop = array_rand($cards,1);
$flop = $cards[$rndflop];
echo "flop:<br>$flop";
echo "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
$randArr = array_rand($cards,13);
$userC = array();
echo "<center>Your cards are:<br> ";
for($counter=0;$counter<=12;$counter++)
{
$userC[$counter] = $cards[$randArr[$counter]];
echo $userC[$counter]." ";
}
?>
I have few problems
-when the computer for example get 2 king I can get even 3 kings, which means there is no maximum cards of each kind.
-Since the array values are images I cant do any Mathematical calculations.
any suggestions?
Thanks in advanced.