3 function mymail($To,$Subject,$message)
9 $message = str_replace("\n","<br />",$message);
10 echo "<br />To: $To<br />Subject: $Subject <br />$message<br />\n";
13 mail($To,$Subject,$message);
17 function is_trump($c) { return (($c<27) ? 1:0);}
18 function is_club($c) { return (in_array($c,array('27','28','29','30','31','32','33','34')));}
19 function is_spade($c) { return (in_array($c,array('35','36','37','38','39','40','41','42')));}
20 function is_heart($c) { return (in_array($c,array('43','44','45','46','47','48')));}
22 function compare_cards($a,$b)
24 /* if a is higher than b return 1, else 0, a being the card first played */
26 /* first map all cards to the odd number */
27 if( $a/2 - (int)($a/2) != 0.5)
29 if( $b/2 - (int)($b/2) != 0.5)
32 if(is_trump($a) && $a<=$b)
34 else if(is_trump($a) && $a>$b)
37 { /*$a is not a trump */
43 if( is_club($a) && is_club($b))
49 if( is_spade($a) && is_spade($b))
55 if( is_heart($a) && is_heart($b))
66 function get_winner($p)
68 /* get all 4 cards played in a trick */
74 /* find out who won */
75 if( compare_cards($c1,$c2) && compare_cards($c1,$c3) && compare_cards($c1,$c4) )
77 if( compare_cards($c2,$c3) && compare_cards($c2,$c4) )
79 if( compare_cards($c3,$c4) )
84 function count_nines($cards)
90 if($c == "25" || $c == "26") $nines++;
91 else if($c == "33" || $c == "34") $nines++;
92 else if($c == "41" || $c == "42") $nines++;
93 else if($c == "47" || $c == "48") $nines++;
99 function check_wedding($cards)
102 if( in_array("3",$cards) && in_array("2",$cards) )
108 function count_trump($cards)
112 /* count each trump */
113 foreach($cards as $c)
118 if( in_array("19",$cards))
120 if( in_array("20",$cards) )
122 /* add one, in case the player has both foxes (schweinchen) */
123 if( in_array("19",$cards) && in_array("20",$cards) )
129 function card_to_name($card)
135 return "ten of hearts";
138 return "queen of clubs";
141 return "queen of spades";
144 return "queen of hearts";
147 return "queen of diamonds";
150 return "jack of clubs";
153 return "jack of spades";
156 return "jack of hearts";
159 return "jack of diamonds";
162 return "ace of diamonds";
165 return "ten of diamonds";
168 return "king of diamonds";
171 return "nine of diamonds";;
174 return "ace of clubs";
177 return "ten of clubs";
180 return "king of clubs";
183 return "nine of clubs";
186 return "ace of spades";
189 return "ten of spades";
192 return "king of spades";
195 return "nine of spades";
198 return "ace of hearts";
201 return "king of hearts";
204 return "nine of hearts";
206 return "something went wrong, please contact the admin. Error: code1.";
210 function card_value($card)
223 case 9: /* diamonds */
226 case 11: /* clubes */
228 case 13: /* spades */
230 case 15: /* hearts */
232 case 17: /* diamonds */
235 case 19: /* diamonds */
239 case 35: /* spades */
241 case 43: /* hearts */
244 case 21: /* diamonds */
248 case 37: /* spades */
251 case 23: /* diamonds */
255 case 39: /* spades */
257 case 45: /* hearts */
260 case 25: /* diamonds */
264 case 41: /* spades */
266 case 47: /* hearts */
270 echo "something went wrong, please contact the admin. ErrorCode: 2<br>";
276 function create_array_of_random_numbers()
284 $r = array_rand($a,48);
292 function display_cards($me,$myturn)
297 function return_timezone($offset)
302 $zone = "Europe/Berlin";
305 $zone = "America/Vancouver";
308 $zone = "Pacific/Auckland";
311 $zone = "Europe/London";