Created
May 23, 2012 13:04
-
-
Save henrikh/2775147 to your computer and use it in GitHub Desktop.
Eurovision bingo board generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bingo_words = {"\\textit{Love}", | |
"\\textit{Peace}", | |
"\\textit{Heart}", | |
"\\textit{Family}", | |
"\\textit{Europe}", | |
"\\textit{Baku}", | |
"\\textit{Eurovision}", | |
"\\textit{Together}", | |
"\\textit{One}", | |
"Instrumental section", | |
"Vocal section", | |
"Reprise section", | |
"Fireworks/pyrotechnics", | |
"Futuristic looking instruments", | |
"Clowns", | |
"Traditional/national dancing", | |
"Name of any European capital"} | |
function table.copy(t) | |
local u = { } | |
for k, v in pairs(t) do u[k] = v end | |
return setmetatable(u, getmetatable(t)) | |
end | |
function takeWord(list) | |
return table.remove(bingo_words, math.random(table.getn(bingo_words))) | |
end | |
function getWords(input) | |
local data = table.copy(input) | |
heap = {} | |
for index = 1,12 do | |
table.insert(heap,table.remove(data, math.random(table.getn(data)))) | |
end | |
return heap | |
end | |
function insert_blanks(input) | |
local data = table.copy(input) | |
for index = 1,2 do | |
table.insert(data, math.random(table.getn(data)), "") | |
end | |
return data | |
end | |
function build_table(input) | |
local data = table.copy(input) | |
local data_string = "" | |
for index = 1,table.getn(data) do | |
data_string = data_string .. data[index] | |
if math.mod(index, 4) == 0 then | |
data_string = data_string .. " \\nl " | |
else | |
data_string = data_string .. " & " | |
end | |
end | |
return data_string | |
end | |
tex.print(build_table(getWords(bingo_words))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{array} | |
\usepackage{calc} | |
\usepackage{pgffor} | |
\usepackage{helvet} | |
\renewcommand{\familydefault}{\sfdefault} | |
\usepackage[landscape,a5paper]{geometry} | |
\geometry{verbose,tmargin=0.2cm,bmargin=0.2cm,lmargin=0.2cm,rmargin=0.2cm,headheight=0cm,headsep=0cm,footskip=0cm} | |
\setlength{\parindent}{0pt} | |
\newlength\celldim | |
\newlength\fontheight | |
\newlength\extraheight | |
\newcounter{sqcolumns} | |
\newcolumntype{S}{ | |
@{} | |
>{\centering \rule[-0.5\extraheight]{0pt}{\fontheight + \extraheight}% | |
\begin{minipage}{\celldim}\centering} | |
p{\celldim} | |
<{\end{minipage}} | |
@{} } | |
\newcolumntype{Z}{ @{} >{\centering} p{\celldim} @{} } | |
\newenvironment{squarecells}[1] | |
{\setlength\celldim{0.244\paperwidth}% | |
\settoheight\fontheight{A}% | |
\setlength\extraheight{\celldim - 1.72\fontheight}% | |
\setcounter{sqcolumns}{#1 - 1}% | |
\begin{tabular}{|S|*{\value{sqcolumns}}{Z|}}\hline} | |
% squarecells tabular goes here | |
{\end{tabular}} | |
\newcommand\nl{\tabularnewline\hline} | |
\begin{document} | |
\typein[\boardcount]{How many boards do you want? } | |
\pagenumbering{gobble} | |
\huge | |
\foreach \n in {1,...,\boardcount} {% | |
\begin{squarecells}{4}% | |
\directlua{ dofile('ev-bingo-board.lua') }% | |
\end{squarecells}% | |
\newpage% | |
} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment