發新話題
打印

預算賽電腦抽籤代碼公告

[Close]

預算賽電腦抽籤代碼公告

未表公正先公開抽籤關鍵程式代碼
複製內容到剪貼板
代碼:
$count = 0;
srand((float) microtime() * 10000000);
while(count($team_list))
{
        $team_a = NULL;
        $team_b = NULL;

    $index = array_rand($team_list);
    $team_a = $team_list[$index];
    unset($team_list[$index]);
   
    if($team_a==3 || $team_a==20 || $team_a==27 || $team_a==24)  // 四隊種仔隊不用打預選直到16強
    {
        $team_b = 0;
        $query = sprintf('INSERT INTO game_nob5_team_pair (step,num_team,num_round,teams,regdate) VALUES (%d, 2, 3, "%s", "%s")',
            $step,
            $team_a.','.$team_b,
            date("y-m-d H:i:s")
        );
        mysql_query($query, $sql);
        $count++;
        continue;
    }
   
    if(count($team_list) == 0)
    {
        $team_b = 0; // 單數隊, 不戰勝
    }
    else
    {
        $index = array_rand($team_list);
        $team_b = $team_list[$index];
        unset($team_list[$index]);
    }
   
    $team_n = 0;
    if($team_a > $team_b)
    {
        $team_n = $team_a;
        $team_a = $team_b;
        $team_b = $team_n;
    }
   
    if($team_a==18 && $team_b==45)  //避開分隊
    {
        array_push($team_list, $team_a);
        array_push($team_list, $team_b);
        continue;
    }
   
    if($team_a==27 && $team_b==28) //避開分隊
    {
        array_push($team_list, $team_a);
        array_push($team_list, $team_b);
        continue;
    }   
   
    if($team_a==11 && $team_b==49) //避開分隊
    {
        array_push($team_list, $team_a);
        array_push($team_list, $team_b);
        continue;
    }
   
    if($team_a==16 && $team_b==26) //避開分隊
    {
        array_push($team_list, $team_a);
        array_push($team_list, $team_b);
        continue;
    }
   
    if($team_a==40 && $team_b==49) //避開分隊
    {
        array_push($team_list, $team_a);
        array_push($team_list, $team_b);
        continue;
    }
   
    $query = sprintf('INSERT INTO game_nob5_team_pair (step,num_team,num_round,teams,regdate) VALUES (%d, 2, 3, "%s", "%s")',
        $step,
        $team_a.','.$team_b,
        date("y-m-d H:i:s")
    );
    mysql_query($query, $sql);
   
    $count++;
}

TOP

姐係點????????????

TOP

拿拿林抽好過啦..

TOP

我地要抽籤結果not 代碼

TOP

唔識電腦都人都唔會明呢d野up乜啦:

TOP

=.= sad 龍大哥
姐係咁 
好多人 已經 好心急

TOP

效率好慢=.=講明12點     

TOP

唔係話慢唔慢
人地等左咁耐
你公佈d 咁既野=.=
人地 一心諗住 有野睇
點知
你開d咁既野
so sad

TOP

都唔守時既
又話12點前

TOP

請不要引起公憤                  

TOP

電腦始終都係計算..
真正既隨意抽取好似係4月美國科學家先實驗緊(即沒有任可計算方式)
可能過左幾個月..我知道既野落後左...
都有可能係龍大超越左佢地...(今年Nobel是你的)

始終都係人手抽最有驚喜.......
英軍悶和

TOP

發新話題