Generate tambola (housie) game ticket using php
Tambola game logic :- Tambola ticket consists 3 rows and 9 columns which makes 27 spaces. Each row has a total 5 numbers printed and total 4 spaces are empty. And column can have 1,2 or 3 numbers printed on it. Number should not be repeat in each spaces. Code :- <?php $numberOfRows = 3; //decides number of rows $totalNumber = 100; //decides total number $numberOfColoumn = 9; // decides number of coloums $emptySpace = 4; // decides empty spaces $number = array_chunk(range(1,$totalNumber), 10); $col1 = []; $array1 = $number[0]; $randIndex1 = array_rand($array1,$numberOfRows); for ($i=0; $i < $numberOfRows; $i++) { $col1[$i] = $array1[$randIndex1[$i]]; } $col2 = []; $array1 = $number[1]; $randIndex1 = array_rand($array1,$numberOfRows); for ($i=0; $i < $numberOfRows; $i++) { $col2[$i] = $array1[$randIndex1[...
Comments
Post a Comment
If you have any doubts, Please let me know