diff options
author | Arun Persaud <arun@nubati.net> | 2007-06-17 18:55:34 +0200 |
---|---|---|
committer | Arun Persaud <arun@nubati.net> | 2007-06-17 18:55:34 +0200 |
commit | 44adf43ccb058fb76e7bdbb18917ca86a7f7ec29 (patch) | |
tree | d1bcf0e963337d8280bcef54418c93152653e920 /functions.php | |
parent | 7c54cc81a26bb8a58a0b5ea4dbf4e819fba65d11 (diff) | |
download | e-DoKo-44adf43ccb058fb76e7bdbb18917ca86a7f7ec29.tar.gz e-DoKo-44adf43ccb058fb76e7bdbb18917ca86a7f7ec29.tar.bz2 e-DoKo-44adf43ccb058fb76e7bdbb18917ca86a7f7ec29.zip |
NEW FEATURE: reuse random numbers from old games
random numbers generated for old games are reused in case none
of the players were in that old game. Will be interesting how different
people play with the same hand ;)
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/functions.php b/functions.php index 997ba43..4f33f1e 100644 --- a/functions.php +++ b/functions.php @@ -423,7 +423,7 @@ function card_value($card) } -function create_array_of_random_numbers() +function create_array_of_random_numbers($useridA,$useridB,$useridC,$useridD) { global $debug; @@ -446,10 +446,21 @@ function create_array_of_random_numbers() } else { + /* check if we can find a game were non of the player was involved and return + * cards insted + */ + $userstr = implode(",",array($useridA,$useridB,$useridC,$useridD)); + $randomnumbers = DB_get_unused_randomnumbers($userstr); + $randomnumbers = explode(":",$randomnumbers); + + if(sizeof($randomnumbers)==48) + return $randomnumbers; + + /* need to create new numbers */ for($i=0;$i<48;$i++) $r[$i]=$i+1; - shuffle($r); + shuffle($r); }; return $r; |