+
+ }
+ else if(isset($_REQUEST["win"]) && strlen($history[sizeof($history)-1])>3)
+ {
+ $win=$_REQUEST["win"];
+ $history[]=$win.":\n";
+ /* count points of the last trick */
+ $points=0;
+ echo "<br>".$history[sizeof($history)-2]."is the last trick played<br>";
+ $tmp = explode(":",$history[sizeof($history)-2]);
+ for($i=0;$i<4;$i++)
+ {
+ $tmp2 = explode("->",$tmp[$i]);
+ $c = $tmp2[1];
+ $points += card_value($c);
+ echo "adding card value ".card_value($c)."<br>";
+ }
+ $player[$hash[$win]]["points"]+=$points;
+ echo "<br> ".$player[$hash[$win]]["name"]." won: $points Points <br>";
+
+ save_status();
+ }
+ echo "<br />";
+
+ $tmp = explode(":",$history[sizeof($history)-1]);
+
+ if(sizeof($tmp)==5)
+ {
+ ?>
+<form action="index.php" method="post">
+
+<?php
+ for($i=0;$i<4;$i++)
+ echo $player[$hash[$i]]["name"]." <input type=\"radio\" name=\"win\" value=\"$i\" />";
+ echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />";
+?>
+<input type="submit" value="who will win?" />
+
+</form>
+<?php
+ }
+ else if(sizeof($tmp)<5 && 1<sizeof($tmp) && !isset($_REQUEST["card"]))
+ {
+ if(sizeof($tmp)==2 && strlen($tmp[0])==1)
+ {
+ $next=$tmp[0];
+ echo "found the start of a new trick at $next<br>";
+ if(strlen(trim($player[$me]["cards"]))==0)
+ {
+ echo "<br> game over, count points <br>";
+ for($i=0;$i>4;$i++)
+ {
+ echo $player[$hash[$i]]["name"]." got ".$player[$hash[$i]]["points"]."<br>";
+ }
+ }
+ }
+ if($hash[$next]==$me && strlen(trim($player[$me]["cards"]))>0 )
+ {
+
+ echo "ITS YOUR TURN<br>";
+ $allcards = trim($player[$me]["cards"]);
+ $mycards = explode(";",$allcards);
+
+ sort($mycards);
+ echo "your cards are <br>";
+ foreach($mycards as $card)
+ {
+ display_link_card($card,$me);
+ }
+ echo "<br />\n";
+ }
+ echo "<br />";
+