<?php
/**
 * 概率测试脚本
 * @author solu
 */

ini_set("display_errors", "On");
set_time_limit(0);
error_reporting(E_ALL & ~E_NOTICE);

$st = microtime(true);

require_once realpath(dirname(__FILE__)) . '/../common.php';

$total = 0;
$win = [];
$bp = 0;
$pp = 0;
$ap = 0;
for ($i = 4534390; $i < 4634390; $i+=6) {
    try {
        $data = Game::revealGameData($i, 0);
    } catch (Exception $e) {
        var_dump($e->getMessage());
        continue;
    }

    $total += 1;
    $win[$data[0]] += 1;
    $data[3] && $pp += 1;
    $data[4] && $bp += 1;
    if ($data[3] && $data[4]) {
        $ap += 1;
    }

    if ($total % 20 == 0) {
        $pw = round($win[0] / $total, 4);
        $bw = round($win[1] / $total, 4);
        $tie = round($win[2] / $total, 4);
        $ppp = round($pp / $total, 4);
        $bpp = round($bp / $total, 4);
        $app = round($ap / $total, 4);

        var_dump("总场次{$total}, 闲{$win[0]}-{$pw}, 庄{$win[1]}-{$bw}, 和{$win[2]}-{$tie}，闲对{$pp}-{$ppp}，庄对{$bp}-{$bpp}，同对{$ap}-{$app}");
    }
}

var_dump("总场次{$total}, 闲{$win[0]}-{$pw}, 庄{$win[1]}-{$bw}, 和{$win[2]}-{$tie}，闲对{$pp}-{$ppp}，庄对{$bp}-{$bpp}");
