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,$mode)
24 /* if "a" is higher than "b" return 1, else 0, "a" being the card first played */
26 /* don't think we need this */
27 if( $a/2 - (int)($a/2) != 0.5)
29 if( $b/2 - (int)($b/2) != 0.5)
49 /* first map all cards to the odd number */
50 if(is_trump($a) && $a<=$b)
52 else if(is_trump($a) && $a>$b)
55 { /*$a is not a trump */
61 if( is_club($a) && is_club($b))
67 if( is_spade($a) && is_spade($b))
73 if( is_heart($a) && is_heart($b))
84 function get_winner($p,$mode)
86 /* get all 4 cards played in a trick */
92 /* find out who won */
93 if( compare_cards($c1,$c2,$mode) && compare_cards($c1,$c3,$mode) && compare_cards($c1,$c4,$mode) )
95 if( compare_cards($c2,$c3,$mode) && compare_cards($c2,$c4,$mode) )
97 if( compare_cards($c3,$c4,$mode) )
102 function count_nines($cards)
106 foreach($cards as $c)
108 if($c == "25" || $c == "26") $nines++;
109 else if($c == "33" || $c == "34") $nines++;
110 else if($c == "41" || $c == "42") $nines++;
111 else if($c == "47" || $c == "48") $nines++;
117 function check_wedding($cards)
120 if( in_array("3",$cards) && in_array("2",$cards) )
126 function count_trump($cards)
130 /* count each trump */
131 foreach($cards as $c)
136 if( in_array("19",$cards))
138 if( in_array("20",$cards) )
140 /* add one, in case the player has both foxes (schweinchen) */
141 if( in_array("19",$cards) && in_array("20",$cards) )
147 function card_to_name($card)
153 return "ten of hearts";
156 return "queen of clubs";
159 return "queen of spades";
162 return "queen of hearts";
165 return "queen of diamonds";
168 return "jack of clubs";
171 return "jack of spades";
174 return "jack of hearts";
177 return "jack of diamonds";
180 return "ace of diamonds";
183 return "ten of diamonds";
186 return "king of diamonds";
189 return "nine of diamonds";;
192 return "ace of clubs";
195 return "ten of clubs";
198 return "king of clubs";
201 return "nine of clubs";
204 return "ace of spades";
207 return "ten of spades";
210 return "king of spades";
213 return "nine of spades";
216 return "ace of hearts";
219 return "king of hearts";
222 return "nine of hearts";
224 return "something went wrong, please contact the admin. Error: code1.";
228 function card_value($card)
241 case 9: /* diamonds */
244 case 11: /* clubes */
246 case 13: /* spades */
248 case 15: /* hearts */
250 case 17: /* diamonds */
253 case 19: /* diamonds */
257 case 35: /* spades */
259 case 43: /* hearts */
262 case 21: /* diamonds */
266 case 37: /* spades */
269 case 23: /* diamonds */
273 case 39: /* spades */
275 case 45: /* hearts */
278 case 25: /* diamonds */
282 case 41: /* spades */
284 case 47: /* hearts */
288 echo "something went wrong, please contact the admin. ErrorCode: 2<br>";
294 function create_array_of_random_numbers()
302 $r = array_rand($a,48);
310 function display_cards($me,$myturn)
315 function return_timezone($offset)
320 $zone = "Europe/Berlin";
323 $zone = "America/Vancouver";
326 $zone = "Pacific/Auckland";
329 $zone = "Europe/London";