probabilityTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * 概率测试脚本
  4. * @author solu
  5. */
  6. ini_set("display_errors", "On");
  7. set_time_limit(0);
  8. error_reporting(E_ALL & ~E_NOTICE);
  9. $st = microtime(true);
  10. require_once realpath(dirname(__FILE__)) . '/../common.php';
  11. $total = 0;
  12. $win = [];
  13. $bp = 0;
  14. $pp = 0;
  15. $ap = 0;
  16. for ($i = 4534390; $i < 4634390; $i+=6) {
  17. try {
  18. $data = Game::revealGameData($i, 0);
  19. } catch (Exception $e) {
  20. var_dump($e->getMessage());
  21. continue;
  22. }
  23. $total += 1;
  24. $win[$data[0]] += 1;
  25. $data[3] && $pp += 1;
  26. $data[4] && $bp += 1;
  27. if ($data[3] && $data[4]) {
  28. $ap += 1;
  29. }
  30. if ($total % 20 == 0) {
  31. $pw = round($win[0] / $total, 4);
  32. $bw = round($win[1] / $total, 4);
  33. $tie = round($win[2] / $total, 4);
  34. $ppp = round($pp / $total, 4);
  35. $bpp = round($bp / $total, 4);
  36. $app = round($ap / $total, 4);
  37. var_dump("总场次{$total}, 闲{$win[0]}-{$pw}, 庄{$win[1]}-{$bw}, 和{$win[2]}-{$tie},闲对{$pp}-{$ppp},庄对{$bp}-{$bpp},同对{$ap}-{$app}");
  38. }
  39. }
  40. var_dump("总场次{$total}, 闲{$win[0]}-{$pw}, 庄{$win[1]}-{$bw}, 和{$win[2]}-{$tie},闲对{$pp}-{$ppp},庄对{$bp}-{$bpp}");