-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgen_latex_apprentice_bingo
executable file
·283 lines (264 loc) · 11.8 KB
/
gen_latex_apprentice_bingo
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#!/usr/bin/env python3
import random
import argparse
import subprocess
import os
contestants=["Alex",
"Camilla",
"Daniel",
"David",
"Frank",
"Jackie",
"Jasmine",
"Kayode",
"Khadija",
"Kurran",
"Rick",
"Sabrina",
"The Other Sarah",
"Sarah Ann",
"Sian",
"Tom"]
interviews=["``I'm the best me I can be.''",
"``I've come from nothing.''",
"``I didn't need no education.''",
"``I'm in this to win.''",
"``Are you a one trick pony?''",
"``You're not listening to me!''",
"``The bottom line is [...]''",
"``I'm a born leader!''",
"``This was a disastrous interview.''",
"``X is full of bullshit!''",
"``It's so unfair!''",
"``It says here on your CV [...]''",
"``Please let me finish.''",
"``You're interrupting me!''",
"``I'm not a passenger.''",
"``The gloves are coming off.''",
"``You've got to man-up!''",
"``I mean business.''",
"``The sky's the limit.''",
"``I'm exactly what it says on the tin''",
"``CAN I JUST SAY...''",
"``LOOK, [...]''",
"``I don't want to hear from you any more/I'm fed up with hearing you.''",
"``Shambles!''",
"``110\%''",
"``At the end of the day''",
"Karen calls upon someones bullshit",
"Running to phone in PJs",
"A reference to a tough upbringing",
"Lord Sugar makes a terrible terrible joke",
"Fog happens to coincide with early morning minivans-driving-away-from-house shot",
"Blatant discrepancy between fired candidate's clothing with departing taxi shots",
"Candidate refers to themself in the third person",
"Someone forgets to call Alan Sugar a lord",
"Lord Sugar gets angry because someone forgets to call him a Lord",
"Lord Sugar arrives unannounced into the house",
"Lord Sugar talking from really far away in a building",
"Lord Sugar talking from so far away, they've had to put him on a monitor",
"Candidate has a breakdown and admits they aren't Superman",
"Candidate compares self to Lord Sugar",
"Candidate cries",
"Candidate states that the day is the worst of their life",
"``Rather you than me''",
"Candidate makes impossible promise that interviewer calls on",
"Interviewer insults candidate's background",
"``Bloody''",
"Stink eye",
"Candidate cries"]
tasks=["``I'm the best me I can be.''",
"``I've come from nothing.''",
"``I didn't need no education.''",
"``Let me take charge.''",
"``I could have done a better job, but didn't volunteer myself.''",
"``I do this in my day job.''",
"``I deserve to be project manager.''",
"``I'm in this to win.''",
"``This is the last time I want to see you here in the [elimination round].''",
"``Are you a one trick pony?''",
"``You're not listening to me!''",
"``Failure is not an option.''",
"``I knew we should've gone with my gut instead.''",
"``The bottom line is [...]''",
"``I'm a born leader!''",
"``This was a disastrous task.''",
"``X is full of bullshit!''",
"Lord Sugar questioning his need for salesmen",
"``It's so unfair!''",
"``It says here on your CV [...]''",
"``WHAT WENT WRONG!?!?!?!''",
"``Please let me finish.''",
"``I've got a girlfriend/boyfriend.''",
"``You're interrupting me!''",
"``I'm not a passenger.''",
"``CLAUDE tells me [...]''",
"``The gloves are coming off.''",
"``You've got to man-up!''",
"``You lost us this task.''",
"``A load of toot.''",
"``I mean business.''",
"``Lean mean selling machine.''",
"``The sky's the limit.''",
"``I'm exactly what it says on the tin''",
"``You lost us the task''",
"``Just give me one more chance''",
"``CAN I JUST SAY...''",
"``LOOK, [...]''",
"``I'm an expert at this, trust me, it's my background''",
"``They can't make a decision''",
"``I can't lose in this task''",
"``X feels threatened by me.''",
"``I don't want to hear from you any more/I'm fed up with hearing you.''",
"``I take responsibility''",
"``I'm going to give you the benefit of the doubt.''",
"``Shambles!''",
"``110\%''",
"``At the end of the day''",
"``We're running behind''",
"``X (and Y) let the team down''",
"``Trust me''",
"``The task is a nightmare''",
"``I don't deserve to be here''",
"Music ripped off from another BBC TV series",
"Slow batting of eyelashes",
"Candidate admits failure is their fault",
"Candidate insists they could make a lot of money with Lord Sugar",
"Sexist sales technique",
"Karen is bewildered by a candidate",
"Candidates stereotype potential customers",
"Team fails to meet goal/deadline",
"Sale falls through because other team members keeps interrupting",
"Flirty sales patter after a sale has already been made",
"Karen raises eyebrow",
"Karen rolls eyes",
"Karen calls upon someones bullshit",
"Task-based pun",
"Running to phone in PJs",
"Claude scowls at someone",
"Claude insults candidate or their ideas",
"Flirty sales patter fails",
"Candidates become romantically involved",
"A reference to a tough upbringing",
"Lord Sugar gets annoyed about people losing him money",
"The prize for winning a task involves going in a helicopter",
"People have to run because they have a stupid deadline",
"Lord Sugar makes a terrible terrible joke",
"DOUBLE FIRING",
"Fog happens to coincide with early morning minivans-driving-away-from-house shot",
"Obvious product placement despite the BBC",
"Blatant discrepancy between fired candidate's clothing with departing taxi shots",
"Candidate refers to themself in the third person",
"Someone forgets to call Alan Sugar a lord",
"Lord Sugar gets angry because someone forgets to call him a Lord",
"A candidate chases someone down the street to sell them something",
"Lord Sugar arrives unannounced into the house",
"Someone cancels a telephone call in the middle of a conversation",
"Lord Sugar talking from really far away in a building",
"Lord Sugar talking from so far away, they've had to put him on a monitor",
"Project Manager drank the Kool-Aid and now fanatically believes in \#TEAM :'D",
"Project Manager has a breakdown and admits they aren't Superman",
"Awkward moment when candidates at the house slag off the person who just returned",
"Candidate compares self to Lord Sugar",
"Slagging off teammates outside of the boardroom",
"``Bloody''",
"Both teams choose to do business with the same person",
"Stink eye",
"Candidate cries",
"Candidate feels snubbed in leadership bid"]
def create_table(size, table, name="bingo.tex", directory=''):
table = table[:]
with open(os.path.join(directory,name), 'w') as f:
f.write(r"""\documentclass[a4paper,12pt]{article}
\usepackage{tabularx}
\title{Apprehended Swalies bingo}
\author{Murray Colpman, Tom Leese, Alice Hawke}
\setlength{\tabcolsep}{18pt}
\renewcommand{\arraystretch}{2}
\begin{document}
\maketitle
\section{Bingo!}
%s
\begin{center}
\begin{tabularx}{\linewidth}{|""" % name.split('.')[0].replace('_', '\_'))
for i in range(size):
f.write(r"X|")
f.write(r"""}
\hline
""")
for i in range(size):
for j in range(size):
item = random.choice(table)
table.remove(item)
f.write(item)
if j + 1 != size:
f.write(" & ")
f.write(r""" \\ \hline
""")
f.write(r"""\end{tabularx}
\end{center}
\end{document}
""")
f.close()
create_pdf(name, directory)
def create_contestant_table(size, prefix='', directory=''):
create_table(size, contestants, name=prefix+'.tex', directory=directory)
def create_interview_table(size, prefix='', directory=''):
create_table(size, interviews, name=prefix+'.tex', directory=directory)
def create_task_table(size, prefix='', directory=''):
create_table(size, tasks, name=prefix+'.tex', directory=directory)
def create_all_tables(size, prefix='', suffix='', directory=''):
create_contestant_table(size, prefix=prefix + '_contestants' + suffix, directory=directory)
create_interview_table(size, prefix=prefix + '_interviews' + suffix, directory=directory)
create_task_table(size, prefix=prefix + '_tasks' + suffix, directory=directory)
def create_tex_files(args):
tables = args.tables if args.tables else None
players = args.players if args.players else None
filename = args.filename if args.filename else ''
contestantsSuffix = ''
interviewsSuffix = ''
tasksSuffix = ''
if (not tables is None) and len(tables) != 1:
contestantsSuffix = 'contestants'
interviewsSuffix = 'interviews'
tasksSuffix = 'tasks'
if not players is None:
contestantsSuffix = '_' + contestantsSuffix
interviewsSuffix = '_' + interviewsSuffix
tasksSuffix = '_' + tasksSuffix
if players is None:
if tables is None:
create_all_tables(args.size, suffix=filename, directory=args.output)
else:
if 'contestants' in tables:
create_contestant_table(args.size, prefix=contestantsSuffix + filename, directory=args.output)
if 'interviews' in tables:
create_interview_table(args.size, prefix=interviewsSuffix + filename, directory=args.output)
if 'tasks' in tables:
create_task_table(args.size, prefix=tasksSuffix + filename, directory=args.output)
else:
for p in players:
if tables is None:
create_all_tables(args.size, prefix=p+'_' + filename, directory=args.output)
else:
if 'contestants' in tables:
create_contestant_table(args.size, prefix=p + contestantsSuffix + filename, directory=args.output)
if 'interviews' in tables:
create_interview_table(args.size, prefix=p + interviewsSuffix + filename, directory=args.output)
if 'tasks' in tables:
create_task_table(args.size, prefix=p + tasksSuffix + filename, directory=args.output)
def create_pdf(texfile, directory):
if directory == '':
subprocess.call(["pdflatex", texfile])
else:
print("pdflatex", "-output-directory", directory, texfile)
subprocess.call(["pdflatex", "-output-directory", directory, texfile])
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--players', nargs='+', help='Names of the bingo players.')
parser.add_argument('-t', '--tables', choices=['contestants', 'interviews', 'tasks'], nargs='+', help='The tables to generate.')
parser.add_argument('-s', '--size', nargs='?', help='Size of the table to generate. Recommend: 3.', type=int, default=3)
parser.add_argument('-o', '--output', help='Output files to a specific directory.', default='')
parser.add_argument('-f', '--filename', help='Extra suffix for filename (to be placed after player and table name but before extension)')
args = parser.parse_args()
if __name__ == '__main__':
create_tex_files(args)