Link.FYI

Pastebin

Create New My Pastes

Code (PHP) pasted on 2019-01-31, 22:14 Raw Source

  1. <?php
  2. function getTetrominos(int $count): string {
  3.    $bag = [];
  4.    $tetrominoOrder = "";
  5.    for ($i = 0; $i < 50; ++$i) {
  6.       if (count($bag) == 0) {
  7.         $bag = initTetrominoBag();
  8.       }
  9.       $tetrominoOrder .= array_pop($bag);
  10.    }
  11.    return $tetrominoOrder;
  12. }
  13.  
  14. function initTetrominoBag(): array {
  15.    $bag = ['I', 'O', 'L', 'J', 'T', 'S', 'Z'];
  16.    shuffle($bag);
  17.    return $bag;
  18. }
  19.  
  20. echo getTetrominos(50);