I'm working on a card game... guess the next card...but at the moment ...i don't know much about php in general, because i normally work with java to make such games.
So I can use a littlebit help to create the card game... even with pictures to see the first or to see the next card...(actually)
Does anyone have this kind of cardgame?
where i can leech 😃 the code from so i can see what i have to do to make it work in a proper way?
here is the code i already figure out...but with lots of bugs in it
<?php
$max=13;
$min=1;
$seen=mijn_rand($min, $max);
$last=0;
$check=1;
$begin=0;
$tel=0;
function winner() {
echo "Lucky guess";
}
function loser() {
echo "You made a mistake";
}
function Watch($seen,$begin)
{
$kindofcard = rand ( 1,4);
switch($kindofcard)
{
case 1: $cardtype = "hearts(H)";
break;
case 2: $cardtype = "ruiten(R)";
break;
case 3: $cardtype = "schoppen(S)";
break;
case 4: $cardtype = "klaveren(K)";
break;
}
if($seen>1 && $seen<11)
{
echo (" $cardtype $seen ");
}
switch($seen)
{
case 1: echo " $cardtype ace";
break;
case 11: echo " $cardtype jack";
break;
case 12: echo " $cardtype dame";
break;
case 13: echo " $cardtype heer";
break;
}
$begin=$seen;
return $begin;
}
function SaveCard($thelast)
{
$my_array[$tel]=$thelast;
$tel=$tel+1;
return $my_array;
}
/ functies moeten erbuiten staan /
//de randomfunctie:
function mijn_rand($mini, $maxi)
{
return(rand() % (($maxi -$mini) +1) +$mini);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
<meta name="copyright" content="Boris Svenich" />
<TITLE>High or low</TITLE>
</HEAD>
<BODY>
The card of the moment is<br />
<?php $recent=$putthrough;
$last=WatchCard($seen,$begin);
$tabel=SaveCard($last);
echo'<br /> ';
if (($guess == 'Higher' && $last > $recent) ||
($guess == 'Lower' && $last < $recent)) {
winner();
}
else
{
loser();
}
$last = $recent;
?>
<?php
echo '
<br />
<form action="hogerlager4.php" method="get">
"Is the next card higher or lower?"
<BR />
<input type="hidden" name="putthrough" value="<?php echo $recent;?>">
<input type="submit" name="guess" value="Higher" />
<input type="submit" name="guess" value="Lower" />
</form>
<br /><br /> $tabel
';
?>
</BODY>
</HTML>
thanx in advance
greetz