-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path90balbingo.rb
57 lines (51 loc) · 1.19 KB
/
90balbingo.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
numbers = (1..90).to_a #90 numbers in the bingo set
cards = (1..48) #48 tickets will be printed
columns = (1..5) #5 each card has 5 columns
rows = (1..5) #5 each card has 5 rows
output = "<body><html>"
output += "
<style>
body,html{
width: 210mm;
height: 297mm;
margin:0;
padding:0
font-family:verdana;
}
.card{
width:100%
height: 75mm;
}
h2{padding-top:45px}
td{
border:1px dotted black;
padding:13px;
font-size:16px;
}
@page {
size: A4;
margin: 0;
}
table{
width:100%;
border:1px solid black;
}
*{font-family:verdana; text-align:center}
</style>
"
cards.each do |card_i|
index = 0
numbers.shuffle!
output += "<div class='card'><h2>Bingo!</h2><table>"
rows.each do |row_i|
output += "<tr>"
columns.each do |column_i|
output += "<td>#{numbers[index]}</td>"
index += 1
end
output += "</tr>"
end
output += "</table></div>"
end
output += "</body></html>"
File.open('output_bingo.html', 'w') { |file| file.write(output) }