2 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
3 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
7 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
8 <link rel="stylesheet" type="text/css" href="standard.css" />
9 <script type="text/javascript">
11 if(document.getElementById){
14 if(document.getElementById("trick"+i))
15 document.getElementById("trick"+i).style.display = 'none';
17 document.getElementById("trick"+num).style.display = 'block';
21 if(document.getElementById){
24 if(document.getElementById("trick"+i))
34 <body onload="high_last();">
36 <h1> Welcome to E-Doko </h1>
37 <p>(please hit shift-reload:))</p>
44 $host = "http://doko.nubati.net/index.php";
45 $wiki = "http://wiki.nubati.net/index.php?title=EmailDoko";
55 function mymail($To,$Subject,$message)
61 $message = str_replace("\n","<br />",$message);
62 echo "<br />To: $To<br />Subject: $Subject <br />$message<br />\n";
65 mail($To,$Subject,$message);
69 function parse_status()
71 global $game,$history,$player,$hash,$lines;
74 $game["solo-who"] = -1;
75 $game["solo-what"] = "todo";
76 $game["wedding"] = -1;
77 $game["poverty"] = "";
79 $game["startplayer"] = 0;
83 $tmp = explode( ":",$lines[$i]);
85 $player[$tmp[0]]["number"] = $i;
86 $player[$tmp[0]]["hash"] = $tmp[0];
87 $player[$tmp[0]]["name"] = $tmp[1];
88 $player[$tmp[0]]["email"] = $tmp[2];
89 $player[$tmp[0]]["option"] = $tmp[3];
90 $player[$tmp[0]]["points"] = $tmp[4];
91 $player[$tmp[0]]["cards"] = $tmp[5];
92 if(ereg("s",$tmp[3])) $game["init"]++; /* how many players are ready? */
93 if(ereg("P",$tmp[3])) $game["poverty"].= $i; /* players with poverty, could be two, so use a string */
94 if(ereg("N",$tmp[3])) $game["nines"] = $i; /* the player with too many nines, only one possible */
95 if(ereg("W",$tmp[3])) $game["wedding"] = $i; /* the player with the wedding, also only one possible */
96 if(ereg("([OSQJCAH])",$tmp[3],$match) && ($game["solo-who"]<0) )
98 $game["solo-who"] = $i;
99 $game["startplayer"] = $i;
103 $game["solo-what"] = "No Trump";
105 $game["solo-what"] = "Trump";
107 $game["solo-what"] = "Queen";
109 $game["solo-what"] = "Jack";
111 $game["solo-what"] = "Club";
113 $game["solo-what"] = "Spade";
115 $game["solo-what"] = "Heart";
120 /* save the game history */
121 for($i=4;$i<sizeof($lines);$i++)
123 if(!ereg("^[[:space:]]*$",trim($lines[$i])))
125 $history[] = $lines[$i];
129 if(sizeof($history)==0 || (sizeof($history)==1 && strlen($history[0])==3 ))
130 $history[0] = $game["startplayer"].":";
135 function count_nines($cards)
137 $card = explode(";",$cards);
143 if($c == "25" || $c == "26") $nines++;
144 else if($c == "33" || $c == "34") $nines++;
145 else if($c == "41" || $c == "42") $nines++;
146 else if($c == "47" || $c == "48") $nines++;
152 function check_wedding($cards)
154 $card = explode(";",$cards);
158 if( in_array("3",$card) && in_array("2",$card) )
164 function count_trump($cards)
166 $card = explode(";",$cards);
170 /* count each trump */
176 if( in_array("19",$card))
178 if( in_array("20",$card) )
180 /* add one, in case the player has both foxes (schweinchen) */
181 if( in_array("19",$card) && in_array("20",$card) )
187 function card_to_name($card)
193 return "ten of hearts";
196 return "queen of clubs";
199 return "queen of spades";
202 return "queen of hearts";
205 return "queen of diamonds";
208 return "jack of clubs";
211 return "jack of spades";
214 return "jack of hearts";
217 return "jack of diamonds";
220 return "ace of diamonds";
223 return "ten of diamonds";
226 return "king of diamonds";
229 return "nine of diamonds";;
232 return "ace of clubs";
235 return "ten of clubs";
238 return "king of clubs";
241 return "nine of clubs";
244 return "ace of spades";
247 return "ten of spades";
250 return "king of spades";
253 return "nine of spades";
256 return "ace of hearts";
259 return "king of hearts";
262 return "nine of hearts";
264 return "something went wrong, please contact the admin. Error: code1.";
268 function card_value($card)
339 echo "something went wrong, please contact the admin. ErrorCode 2<br>";
344 function display_card($card)
346 if( $card/2 - (int)($card/2) == 0.5)
347 echo "<img src=\"cards/".$card.".png\" alt=\"".card_to_name($card)."\" />\n";
349 echo "<img src=\"cards/".($card-1).".png\" alt=\"".card_to_name($card-1)."\" />\n";
353 function display_link_card($card,$me)
355 if( $card/2 - (int)($card/2) == 0.5)
356 echo "<a href=\"index.php?me=$me&card=$card\"><img src=\"cards/".$card.".png\" alt=\"".card_to_name($card)."\" /></a>\n";
358 echo "<a href=\"index.php?me=$me&card=$card\"><img src=\"cards/".($card-1).".png\" alt=\"".card_to_name($card-1)."\" /></a>\n";
362 function save_status()
364 global $player,$game,$hash,$history;
366 $output = fopen("status.txt","w");
369 foreach($hash as $key)
371 /* sorting the options, not sure why I do that actually */
373 if( ereg("i",$player[$key]["option"]) )
375 if( ereg("s",$player[$key]["option"]) )
377 if( ereg("t",$player[$key]["option"]) )
379 if( ereg("c",$player[$key]["option"]) )
381 if( ereg("N",$player[$key]["option"]) )
383 if( ereg("W",$player[$key]["option"]) )
385 if( ereg("P",$player[$key]["option"]) )
387 if( ereg("O",$player[$key]["option"]) )
389 if( ereg("S",$player[$key]["option"]) )
391 if( ereg("Q",$player[$key]["option"]) )
393 if( ereg("J",$player[$key]["option"]) )
395 if( ereg("C",$player[$key]["option"]) )
397 if( ereg("A",$player[$key]["option"]) )
399 if( ereg("H",$player[$key]["option"]) )
401 $player[$key]["option"]=$tmp;
403 /* saving the player stats */
404 fwrite($output,"".$player[$key]["hash"].":" );
405 fwrite($output,"".$player[$key]["name"].":" );
406 fwrite($output,"".$player[$key]["email"].":" );
407 fwrite($output,"".$player[$key]["option"].":" );
408 fwrite($output,"".$player[$key]["points"].":" );
409 fwrite($output,"".$player[$key]["cards"] .":");
410 fwrite($output,"\n");
412 fwrite($output,"\n");
413 foreach($history as $line)
414 fwrite($output,$line);
416 fwrite($output,"\n");
420 echo "can't open file for writing, please inform the admin.errorcode3";
425 /***************** M A I N **************************/
427 echo "<p>If you find bugs, please list them in the <a href=\"".$wiki."\">wiki</a>.</p>\n";
435 /* check for status file and read it, if possible */
437 if(file_exists("status.txt"))
438 $lines = file("status.txt");
442 /* check if we want to start a new game */
443 if( isset($_REQUEST["PlayerA"]) &&
444 isset($_REQUEST["PlayerB"]) &&
445 isset($_REQUEST["PlayerC"]) &&
446 isset($_REQUEST["PlayerD"]) &&
447 isset($_REQUEST["EmailA"]) &&
448 isset($_REQUEST["EmailB"]) &&
449 isset($_REQUEST["EmailC"]) &&
450 isset($_REQUEST["EmailD"]) && sizeof($lines<2))
452 $PlayerA = $_REQUEST["PlayerA"];
453 $PlayerB = $_REQUEST["PlayerB"];
454 $PlayerC = $_REQUEST["PlayerC"];
455 $PlayerD = $_REQUEST["PlayerD"];
456 $EmailA = $_REQUEST["EmailA"] ;
457 $EmailB = $_REQUEST["EmailB"] ;
458 $EmailC = $_REQUEST["EmailC"] ;
459 $EmailD = $_REQUEST["EmailD"] ;
461 $hashA = md5("AGameOfDoko".$PlayerA.$EmailA);
462 $hashB = md5("AGameOfDoko".$PlayerB.$EmailB);
463 $hashC = md5("AGameOfDoko".$PlayerC.$EmailC);
464 $hashD = md5("AGameOfDoko".$PlayerD.$EmailD);
466 /* send out email, check for error with email */
469 "you are invited to play a game of DoKo (that is to debug the program ;).\n".
470 "Place comments and bug reports here:\n".
471 "http://wiki.nubati.net/index.php?title=EmailDoko\n\n".
472 "The whole round would consist of the following players:\n".
477 "If you want to join this game, please follow this link:\n\n".
480 mymail($EmailA,"You are invited to a game of DoKo","Hello $PlayerA,\n".$message.$hashA);
481 mymail($EmailB,"You are invited to a game of DoKo","Hello $PlayerB,\n".$message.$hashB);
482 mymail($EmailC,"You are invited to a game of DoKo","Hello $PlayerC,\n".$message.$hashC);
483 mymail($EmailD,"You are invited to a game of DoKo","Hello $PlayerD,\n".$message.$hashD);
485 /* read in random.txt */
486 if(file_exists("random.txt"))
487 $random = file("random.txt");
489 die("no random file");
491 $randomNR = explode( ":", $random[2] );
493 /* write initial status into file */
494 $output = fopen("status.txt","w");
497 fwrite($output, "$hashA:$PlayerA:$EmailA:::" );
499 fwrite($output,"$randomNR[$i];" );
500 fwrite($output,"$randomNR[11]:" ); $i++;
501 fwrite($output,"\n");
503 fwrite($output, "$hashB:$PlayerB:$EmailB:::" );
505 fwrite($output,"$randomNR[$i];" );
506 fwrite($output,"$randomNR[23]:" ); $i++;
507 fwrite($output,"\n");
509 fwrite($output, "$hashC:$PlayerC:$EmailC:::" );
511 fwrite($output,"$randomNR[$i];" );
512 fwrite($output,"$randomNR[35]:" ); $i++;
513 fwrite($output,"\n");
515 fwrite($output, "$hashD:$PlayerD:$EmailD:::");
517 fwrite($output,"$randomNR[$i];" );
518 fwrite($output,"$randomNR[47]:" );
519 fwrite($output,"\n");
524 echo "can't open file for writing";
527 if(file_exists("status.txt"))
528 $lines = file("status.txt");
532 /* test if a game is running, else output everything for a new game */
536 <p> no game in progress, please input 4 names and email addresses, please make sure that the addresses are correct! </p>
537 <form action="index.php" method="post">
538 Name: <input name="PlayerA" type="text" size="10" maxlength="20" />
539 Email: <input name="EmailA" type="text" size="20" maxlength="30" /> <br />
541 Name: <input name="PlayerB" type="text" size="10" maxlength="20" />
542 Email: <input name="EmailB" type="text" size="20" maxlength="30" /> <br />
544 Name: <input name="PlayerC" type="text" size="10" maxlength="20" />
545 Email: <input name="EmailC" type="text" size="20" maxlength="30" /> <br />
547 Name: <input name="PlayerD" type="text" size="10" maxlength="20" />
548 Email: <input name="EmailD" type="text" size="20" maxlength="30" /> <br />
550 <input type="submit" value="start game" />
555 { /* load game status */
562 * check if a player wants to accept a game
564 if(isset($_REQUEST["a"]))
568 if( ereg("[is]",$player[$a]["option"]) && $game["init"]<4)
570 echo "just wait for the game to start";
572 else if( !ereg("[is]",$player[$a]["option"]) )
575 <form action="index.php" method="post">
576 Do you want to play a game of DoKo?
577 yes<input type="radio" name="in" value="yes" />
578 no<input type="radio" name="in" value="no" /> <br />
580 Do you want to get an email for every card played or only if it your move?
581 every card<input type="radio" name="update" value="card" />
582 only on my turn<input type="radio" name="update" value="turn" /> <br />
584 echo "<input type=\"hidden\" name=\"b\" value=\"$a\" />\n";
586 echo "<input type=\"submit\" value=\"count me in\" />\n";
595 * yes? email him his hand, ask for solo, poverty, email every move or every card?
597 if(isset($_REQUEST["b"]))
601 if( ereg("s",$player[$b]["option"]) && $game["init"]<4)
602 { /* the player already filled out everything */
603 echo "just wait for the game to start";
605 else if( (!isset($_REQUEST["in"])|| !isset($_REQUEST["update"])) && !ereg("i",$player[$b]["option"]))
606 { /* the player didn't fill out the form at "a" correctly */
608 echo "<a href=\"index.php?a=$b\"> here and fill out the form </a> <br />\n";
611 { /* show the hand and check if the player is sick*/
612 if($_REQUEST["in"]=="no")
613 { /* player doesn't want to play, cancel the game */
616 $message = "Hello ".$player[$hash[$i]]["name"].",\n\n".
617 "the game has been canceled due to the request of one of the players.\n";
618 mymail($player[$hash[$i]]["email"],"[DoKo-Debug] the game has been canceled",$message);
620 /* canceling the game is as easy as removing the contents of the status file*/
621 $output = fopen("status.txt","w");
625 echo "problem opening file";
629 /* player wants to play, save information from "a"*/
630 if($_REQUEST["update"]=="card")
631 $player[$b]["option"] .= "c";
633 $player[$b]["option"] .= "t";
635 $player[$b]["option"] .= "i"; /* player finished stage "a" */
639 $allcards = $player[$b]["cards"];
640 $mycards = explode(";",$allcards);
643 echo "<p class=\"mycards\">your cards are: <br />\n";
644 foreach($mycards as $card)
648 <p> aehm... at the moment poverty is not implented. so I guess you need to play a normal game, even if you have less than 3 trump :(...sorry </p>
650 <form action="index.php" method="post">
652 do you want to play solo?
653 <select name="solo" size="1">
655 <option>No trump</option>
656 <option>Normal solo</option>
657 <option>Queen solo</option>
658 <option>Jack solo</option>
659 <option>Club solo</option>
660 <option>Spade solo</option>
661 <option>Heart solo</option>
668 if(check_wedding($player[$b]["cards"]))
670 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" />";
671 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
675 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
678 echo "do you have poverty?";
679 if(count_trump($player[$b]["cards"])<4)
681 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" />";
682 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
686 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
689 echo "do you have too many nines?";
690 if(count_nines($player[$b]["cards"])>4)
692 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" />";
693 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
697 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
700 echo "<input type=\"hidden\" name=\"c\" value=\"$b\" />\n";
701 echo "<input type=\"submit\" value=\"count me in\" />\n";
708 if(isset($_REQUEST["c"]))
713 if( ereg("s",$player[$c]["option"]) && $game["init"]<4 )
714 { /* the player already filled out everything */
715 echo "<p>just wait for the game to start</p>\n";
717 else if(!isset($_REQUEST["solo"]) ||
718 !isset($_REQUEST["wedding"]) ||
719 !isset($_REQUEST["poverty"]) ||
720 !isset($_REQUEST["nines"]) )
721 {/* player still needs to fill out the form */
723 echo "<a href=\"index.php?b=$c\"> here and fill out the form </a> <br />\n";
725 else if($game["init"]<4)
726 { /* save information */
727 if( $_REQUEST["solo"]!="No")
729 switch($_REQUEST["solo"])
732 $player[$c]["option"].="O";
735 $player[$c]["option"].="S";
738 $player[$c]["option"].="Q";
741 $player[$c]["option"].="J";
744 $player[$c]["option"].="C";
747 $player[$c]["option"].="A";
750 $player[$c]["option"].="H";
754 else if($_REQUEST["wedding"] == "yes")
756 echo "wedding was chosen<br />\n";
757 $player[$c]["option"].="W";
759 else if($_REQUEST["poverty"] == "yes")
761 echo "poverty was chosen<br />\n";
762 $player[$c]["option"].="P";
764 else if($_REQUEST["nines"] == "yes")
766 echo "nines was chosen<br />\n";
767 $player[$c]["option"].="N";
770 /* player finished setup */
771 $player[$c]["option"].="s";
774 /* reread status file, to get the correct startplayer, etc */
775 if(file_exists("status.txt"))
776 $lines = file("status.txt");
781 if($game["init"]==4 && $player[$c]["number"]==$game["startplayer"])
783 echo "<p> The game can start now, it's your turn, please use this <a href=\"".
784 $host."?me=".$hash[$c]."\">link</a> to play a card.</p>\n";
786 else if($game["init"]==4)
788 $message = "The game can start now, it's your turn, please use this link to play a card:\n".
789 $host."?me=".$hash[$game["startplayer"]]."\n";
790 mymail($player[$hash[$game["startplayer"]]]["email"],"[DoKo-debug] let's go",$message);
791 echo "<p> The game has started. An email has been sent out to the first player.</p>\n";
795 echo "<p>You're in. Once everyone has filled out the form, ".
796 "the game will start and you'll get an eamil on your turn.</p>\n";
805 /* check for sickness, only would need to do this on the first trick really...*/
806 /***** someone has 5 nines and no one is playing solo => cancel game */
807 if($game["nines"]>=0 && $game["solo-who"]<0)
809 $message = $player[$hash[$game["poverty"]]]["nines"]." has more than 4 nines. Game aborted!\n";
811 mymail($player[$hash[$i]]["email"],"[DoKo-debug] the game has been canceled",$message);
813 $output = fopen("status.txt","w");
817 echo "problem opening file";
820 /* who is requesting this*/
821 if(!isset($_REQUEST["me"]))
823 if(!isset($_REQUEST["recovery"]))
825 echo "A game is in progress and kibitzing is not allowed. Sorry!.<br />\n";
826 echo "In case you are playing, but lost your email or can't access the game anymore, please input your email here:<br />\n";
828 <form action="index.php" method="post">
829 recorvery: <input name="recovery" type="text" size="20" maxlength="30" /> <br />
830 <input type="submit" value="get me back into the game" />
836 $recovery = $_REQUEST["recovery"];
839 if(trim($recovery)==trim($player[$hash[$i]]["email"]))
843 $message = "Please try this link: ".$host."?me=".$hash[$ok]."\n".
844 "\n if this doesn't work, contact the admin.error4\n";
845 mymail($recovery,"[DoKo-Debug] recovery ",$message);
846 echo "<p> An email with the game information has been sent.</p>\n";
850 echo "<p> can't find this email address, sorry.</p>\n";
856 $me = $_REQUEST["me"];
858 /* output if we are playing a solo or a wedding */
859 if($game["solo-who"]>=0)
860 echo $player[$hash[$game["solo-who"]]]["name"]." is playing a ".$game["solo-what"]." solo!<br />\n";
861 else if($game["wedding"]>=0)
862 echo $player[$hash[$game["wedding"]]]["name"]." is playing a wedding!<br />\n";
865 /* old tricks as list */
866 echo "<ul class=\"oldtrick\">\n";
867 echo " <li> History: </li>\n";
869 foreach($history as $play)
872 $trick = explode(":",$play);
874 /* found old trick, display it */
875 if(sizeof($trick)==5)
876 echo " <li onclick=\"hl('$j');\">Trick $j\n <div class=\"table\" id=\"trick".$j."\">\n <img class=\"table\" src=\"pics/table".$play[0].".png\" alt=\"table\" />\n";
879 /* display current trick */
880 echo "<li onclick=\"hl('$j');\">Current Trick\n <div class=\"table\" id=\"trick".$j."\">\n <img class=\"table\" src=\"pics/table".$play[0].".png\" alt=\"table\" />";
882 for($i=0;$i<sizeof($trick)-1;$i++)
887 /* has a card been played? */
890 $tmp = explode("->",$card);
892 echo " <div class=\"card".$tmp[0]."\">\n";
894 if(strlen($tmp[2])>0)
895 echo " <span class=\"comment\">";
898 echo $player[$hash[$tmp[0]]]["name"];
899 /* check for comment */
900 if(strlen($tmp[2])>0)
901 echo "<span>".$tmp[2]."</span>";
904 display_card($tmp[1]);
911 echo " </div>\n </li>\n";
915 /* figure out who needs to play next */
920 /* if no one has played yet or we are at the start of a new trick */
922 $next = $history[sizeof($history)-1][0];
924 /* are we trying to play a card? */
925 if(isset($_REQUEST["card"]))
927 if($hash[$next]==$me)
929 $card = $_REQUEST["card"];
930 $mycards = explode(";",$player[$me]["cards"]);
932 /* do we have that card */
933 if(in_array($card,$mycards))
935 /* delete card from array */
937 foreach($mycards as $m)
942 for($i=0;$i<sizeof($tmp)-1;$i++)
947 $player[$me]["cards"]=$tmp2;
949 /* add card to history, special case if this is the first card */
952 $history[sizeof($history)-1]="".$player[$me]["number"]."->".$card.":\n";
956 $tmp = explode(":",$history[sizeof($history)-1]);
957 $tmp[sizeof($tmp)-1] = "".$player[$me]["number"]."->".$card.":";
958 $history[sizeof($history)-1]=join(":",$tmp);
962 echo "<div class=\"card\">";
963 echo " you played <br />";
968 <form action="index.php" method="post">
969 A short comment:<input name="comment" type="text" size="30" maxlength="50" />
970 <input type="hidden" name="me" value="<?php echo $me; ?>" />
971 <input type="submit" value="submit comment" />
974 /* send out email to players who want/need to get informed */
975 /* check if we are in a trick, if trick is done, this needs to be handelt in the
976 * who-won-the-trick section further down */
977 $tmp = explode(":",$history[sizeof($history)-1]);
981 $mynext = $next+1; if($mynext>3)$mynext-=4;
983 if((ereg("c",$player[$hash[$i]]["option"]) || $i==$mynext) && $hash[$i]!=$me)
985 $message = " Hello ".$player[$hash[$i]]["name"].",\n\n";
989 $message .= "it's your turn now.\n".
990 "Use this link to play a card: ".$host."?me=".$hash[$i]."\n\n" ;
992 $message .= $player[$me]["name"]." has played the following card ".
993 card_to_name($card)."\n";
995 if($game["solo-who"]>=0)
996 $message .= $player[$hash[$game["solo-who"]]]["name"]." is playing a ".
997 $game["solo-what"]." solo!\n";
999 mymail($player[$hash[$i]]["email"],"[DoKo-debug] a card has been played",$message);
1002 echo "<a href=\"index.php?me=".$hash[$mynext]."\"> next player </a> <br />\n";
1007 echo "seems like you don't have that card<br />\n";
1011 } /* end if card is set */
1012 else if(isset($_REQUEST["comment"]))
1014 $comment = $_REQUEST["comment"];
1015 $tmp = explode(":",$history[sizeof($history)-1]); /*last played trick */
1016 $tmp2 = explode("->",$tmp[sizeof($tmp)-2]); /*last played card */
1018 $comment = str_replace(":","",$comment); /*can't have ":" in comments */
1020 if(sizeof($tmp2)<=2)
1021 $tmp[sizeof($tmp)-2] .= "->".$comment;
1022 $history[sizeof($history)-1]=join(":",$tmp);
1026 else if(isset($_REQUEST["win"]) && substr_count($history[sizeof($history)-1],":")==4)
1027 { /* count points, email winner */
1028 $win = $_REQUEST["win"];
1030 if(strlen($player[$hash[0]]["cards"]))
1031 $history[] = $win.":\n";
1033 /* email the player who needs to move next*/
1036 if((ereg("c",$player[$hash[$i]]["option"]) || $i==$win) )
1038 $message = " Hello ".$player[$hash[$i]]["name"].",\n\n";
1042 $message .= "You won the last trick,it's your turn now.\n".
1043 "Use this link to play a card: ".$host."?me=".$hash[$i]."\n\n" ;
1046 $message .= $player[$hash[$win]]["name"]." has won the last trick\n".
1047 "Use this link to look at the game: ".$host."?me=".$hash[$i]."\n\n" ;
1049 if($game["solo-who"]>=0)
1050 $message.= $player[$hash[$game["solo-who"]]]["name"]." is playing a ".
1051 $game["solo-what"]." solo!\n";
1053 mymail($player[$hash[$i]]["email"],"[DoKo-debug] a card has been played",$message);
1056 echo "<a href=\"index.php?me=".$hash[$win]."\"> next player </a> <br />\n";
1060 /* count points of the last trick */
1063 $tmp = explode(":",$history[sizeof($history)-2]);
1066 $tmp2 = explode("->",$tmp[$i]);
1068 $points += card_value($c);
1070 $player[$hash[$win]]["points"] += $points;
1071 echo "<br />\n ".$player[$hash[$win]]["name"]." won: $points Points <br />\n";
1074 }; /* end if win is set */
1077 /* check last history entry: end of a trick? ask who won it, unless it was the last trick */
1078 $tmp = explode(":",$history[sizeof($history)-1]);
1079 if(sizeof($tmp)==5 && strlen($player[$hash[0]]["cards"]))
1082 <form action="index.php" method="post">
1086 echo $player[$hash[$i]]["name"]." <input type=\"radio\" name=\"win\" value=\"$i\" /><br />";
1087 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />";
1089 <input type="submit" value="submit" />
1094 else if(sizeof($tmp)<5 && 1<sizeof($tmp) && !isset($_REQUEST["card"]))
1096 if(sizeof($tmp)==2 && strlen($tmp[0])==1)
1101 echo "DEBUG: the next move is for <a href=\"index.php?me=".$hash[$next]."\">the next player</a><br />\n";
1102 if(strlen(trim($player[$me]["cards"]))==0)
1104 echo "<br /> game over, count points <br />\n";
1107 echo $player[$hash[$i]]["name"]." got ".$player[$hash[$i]]["points"]."<br />\n";
1112 } /* end check for winner */
1114 /* do we still have cards? display them */
1115 if(strlen(trim($player[$me]["cards"]))>0 )
1117 $allcards = trim($player[$me]["cards"]);
1118 $mycards = explode(";",$allcards);
1122 echo "<p class=\"mycards\">\n";
1123 /* is it our turn? */
1124 if($hash[$next]==$me && !isset($_REQUEST["card"]) && !isset($_REQUEST["win"]))
1126 echo "ITS YOUR TURN! <br />\n";
1127 echo "Your cards are: <br />\n";
1128 foreach($mycards as $card)
1129 display_link_card($card,$me);
1132 { /* not our turn, just show the hand */
1133 echo "Your cards are: <br />\n";
1134 foreach($mycards as $card)
1135 display_card($card);