-
- if(isset($_REQUEST["a"]))
- {
- $a=$_REQUEST["a"];
-
- if( ereg("[is]",$player[$a]["option"]) && $game["init"]<4)
- {
- echo "just wait for the game to start";
- }
- else
- {
-
- ?>
- <form action="index.php" method="post">
- Do you want to play a game of DoKo?
- yes<input type="radio" name="in" value="yes" />
- no<input type="radio" name="in" value="no" /> <br />
-
- Do you want to get an email for every card played or only if it your move?
- every card<input type="radio" name="update" value="card" />
- only on my turn<input type="radio" name="update" value="turn" /> <br />
-<?php
- echo "<input type=\"hidden\" name=\"b\" value=\"$a\" />\n";
- echo "\n";
- echo "<input type=\"submit\" value=\"count me in\" />\n";
- echo " </form>\n";
- }
- }
-
-/* ***
- * * *
- * ***
- * * *
- * ***
- * yes? email him his hand, ask for solo, poverty, email every move or every card?
- */
- if(isset($_REQUEST["b"]))
- {
- $b=$_REQUEST["b"];
-
- if( ereg("[is]",$player[$b]["option"]) && $game["init"]<4)
- {
- echo "just wait for the game to start";
- }
- else if(!isset($_REQUEST["in"])|| !isset($_REQUEST["update"]) )
- {
- echo "go back to ";
- echo "<a href=\"index.php?a=$b\"> here and fill out the form </a> <br />";
- }
- else
- { /* show the hand */
- if($_REQUEST["update"]=="card") $player[$b]["option"].="c";
- if($_REQUEST["update"]=="turn") $player[$b]["option"].="t";
-
- $player[$b]["option"].="i";
-
- save_status();
-
- $allcards = $player[$b]["cards"];
- $mycards = explode(";",$allcards);
-
- sort($mycards);
- echo "your cards are <br>";
- foreach($mycards as $card)
- {
- display_card($card);
- }
- echo "<br />\n";
- ?>
- <form action="index.php" method="post">
-
- do you want to play solo?
- yes<input type="radio" name="solo" value="yes" />
- no<input type="radio" name="solo" value="no" /> <br />
-
- do you have a wedding?
- yes<input type="radio" name="wedding" value="yes" />
- no<input type="radio" name="wedding" value="no" /> <br />
-
- do you have poverty?
- yes<input type="radio" name="poverty" value="yes" />
- no<input type="radio" name="poverty" value="no" /> <br />
-
-<?php
- echo "<input type=\"hidden\" name=\"c\" value=\"$b\" />\n";
- echo "<input type=\"submit\" value=\"count me in\" />\n";
-
- echo "</form>\n";
- }
- }
- if(isset($_REQUEST["c"]))
- {
- $c=$_REQUEST["c"];
-
- if(!isset($_REQUEST["solo"])|| !isset($_REQUEST["wedding"])|| !isset($_REQUEST["poverty"]) )
- {
- echo "go back to ";
- echo "<a href=\"index.php?b=$c\"> here and fill out the form </a> <br />";
- }
- else if( ereg("s",$player[$c]["option"]) && $game["init"]<4 )
- {
- echo "just wait for the game to start";
- }
- else if($game["init"]<4)
- {
- echo "handle krankheit <br />";
-
- echo "email this out: you're in. once everyone has filled out the form,";
- echo "the game will start and you'll get an eamil about it";
-
- $player[$c]["option"].="s";
-
- save_status();
- }
- }
- if($game["init"]==4)
- {
- if(!isset($_REQUEST["me"]))
- echo "a game is in progress, but you are not playing";
- else
- {
- $me = $_REQUEST["me"];
- if(isset($_REQUEST["card"]))
- {
- $card=$_REQUEST["card"];
- echo "EMAIL: you played $card <br>";
- echo "check,if card correct remove card from deck <br>";
-
-
- $tmp = explode(":",$history[sizeof($history)-1]);
- $tmp[sizeof($tmp)-1] = "".$player[$me]["number"]."->".$card.":";
- $history[sizeof($history)-1]=join(":",$tmp);
-
- save_status();
- }
- echo "game in progress and you are in it<br>";
- foreach($history as $play)
- {
- $trick = explode(":",$play);
-
- $last=-1;
- /* found old trick, display it */
- for($i=0;$i<sizeof($trick)-1;$i++)
- {
- $card=$trick[$i];
- $tmp = explode("->",$card);
- echo $player[$hash[$tmp[0]]]["name"]." played ";
- display_card($tmp[1]);
- $last=$tmp[0];
- }
- echo "<br />";
-
-
- $next = $last + 1;
- if ($next>=4)
- $next -= 4 ;
-
- switch(sizeof($trick))
- {
- case 1:
- echo "new trick , next player ".$trick[0]." <br>";
- break;
- case 4:
- echo "figure out who will win<br>";
- case 2:
- case 3:
- echo "some played $next";
- if($hash[$next]==$me)
- {
-
- echo "ITS YOUR TURN<br>";
- $allcards = $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 />";
- break;
- default:
- echo "default<br>";
- }
- }
- }
- }
-
-} /* is this the last player that needs to accept? */
- /* yes, figure out who starts, send out email to first player */
- /* no, email the rest to cancel game */
-
-/* player wants to make a move? */
- /* check if it is this players turn it is (if it's the players turn, convert cards into links) */
- /* if it is the last card played*/
- /* add checkbox for who one the trick */
- /* email next player */
- /* last card played? */
- /* count score for each player */