Advertisement
repente

Untitled

Jun 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Mos\Dice;
  4.  
  5. /**
  6. * Show off a histogram.
  7. */
  8. include(__DIR__ . "/config.php");
  9. include(__DIR__ . "/autoload_namespace.php");
  10.  
  11.  
  12. $rolls = $_GET["rolls"] ?? 6;
  13.  
  14. $dice = new DiceHistogram($rolls);
  15.  
  16. for ($i = 0; $i < $rolls; $i++) {
  17. $dice->roll();
  18. }
  19.  
  20. ?><h1>Display a histogram</h1>
  21.  
  22. <p><?= implode(", ", $dice->getHistogramSerie()) ?></p>
  23. <pre><?= $dice->printHistogram() ?></pre>
  24. <pre><?= $dice->printHistogram(1, 6) ?></pre>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement