- function bunch_make()
- {
- $ct = array(0,0,0,0,0);
-
- mt_srand(make_seed());
-
- for ($i = 39 ; $i >= 0 ; $i--)
- $rest[$i] = $i;
-
- for ($i = 39 ; $i >= 0 ; $i--) {
- $rn = rand(0, $i);
-
- if ($rn == 0)
- log_main("RND ZERO");
-
- $id = $rest[$rn];
-
- $owner = $i % 5;
- $this->card[$id]->assign('hand', $owner);
-
- $rest[$rn] = $rest[$i];
- // $pubbpos[$rn2] = $pubbpos[$i];
- }
- }
-
- function init(&$userarr)
- {
- $this->mazzo = rand(0,PLAYERS_N-1);
- $this->points_n = 0;
- $this->mult = 1;
- $this->old_win =-1;
- $this->old_reason = "";
- for ($i = 0 ; $i < PLAYERS_N ; $i++) {
- $this->total[$i] = 0;
- $user_cur = &$userarr[$this->player[$i]];
- $user_cur->exitislock = TRUE;
- }
-
- log_main("table::init: ci siamo");
- }
-
- function game_init(&$userarr)
- {
- log_rd2("GSTART 4");
-
- $this->gstart = ($this->mazzo+1) % PLAYERS_N;
- $this->bunch_make();
-
-
- $this->asta_pla_n = PLAYERS_N;
- $this->asta_card = -1;
- $this->asta_pnt = 60;
- $this->asta_win = -1;
- $this->briscola = -1;
- $this->friend = -1;
- $this->turn = 0;
-
- for ($i = 0 ; $i < PLAYERS_N ; $i++) {
- $this->asta_pla[$i] = TRUE;
- $user_cur = &$userarr[$this->player[$i]];
- $user_cur->subst = 'asta';
- $user_cur->asta_card = -2;
- $user_cur->asta_pnt = -1;
- $user_cur->handpt = $this->hand_points($i);
- // SEE function calculate_points(&$table)
- }
- }
-
- function game_next()
- {
- $this->mazzo = ($this->mazzo + 1) % PLAYERS_N;
- }
-