Hi all, I am trying to use PHP to generate random uk bingo tickets, It's not as easy as it seems.
The rules are.
You have 6 tickets to a strip, each ticket consists of 3 lines, each line must contain 5 valid number and 4 blanks wich equals 9 on each row.
Column 1 consists of numbers 1-9, column 2 consists of numbers 20-29 and so on.
There are only two columns which differ from the others and they are column one and column 9.
All columns consist of 18 slots and there are a total of 9 columns.
Column 1 must have 9 valid numbers and nine blanks.
You can view a valid bingo ticket here http://www.cowellsarrow.co.uk/images/90number_big.gif
Here is my code.
<?php
$column[] = range(1,9);
$column[] = range(10,19);
$column[] = range(20,29);
$column[] = range(30,39);
$column[] = range(40,49);
$column[] = range(50,59);
$column[] = range(60,69);
$column[] = range(70,79);
$column[] = range(80,90);
for($i = 0; $i<count($column); $i++){
$column[$i] = array_pad($column[$i],18,'--');
shuffle($column[$i]);
print_r($column[$i]);
};//
?>
Is this possible to do ?
Please help.
The rules are.
You have 6 tickets to a strip, each ticket consists of 3 lines, each line must contain 5 valid number and 4 blanks wich equals 9 on each row.
Column 1 consists of numbers 1-9, column 2 consists of numbers 20-29 and so on.
There are only two columns which differ from the others and they are column one and column 9.
All columns consist of 18 slots and there are a total of 9 columns.
Column 1 must have 9 valid numbers and nine blanks.
You can view a valid bingo ticket here http://www.cowellsarrow.co.uk/images/90number_big.gif
Here is my code.
<?php
$column[] = range(1,9);
$column[] = range(10,19);
$column[] = range(20,29);
$column[] = range(30,39);
$column[] = range(40,49);
$column[] = range(50,59);
$column[] = range(60,69);
$column[] = range(70,79);
$column[] = range(80,90);
for($i = 0; $i<count($column); $i++){
$column[$i] = array_pad($column[$i],18,'--');
shuffle($column[$i]);
print_r($column[$i]);
};//
?>
Is this possible to do ?
Please help.