38

Introduction

Hello there, fellow TeX.sx users! I'm organizing a lottery. The idea is very similar to Who Wants to Win a LaTeX Book?, but both the lottery algorithm and the prize are different. Let me explain some things first.

Who are you?

I'm some random dude on the Internet who happens to hang out a lot in this very community. :)

What is the prize?

The prize will be a lovely duck.

Wait a minute, did you say duck?

Yes! :) But not a real duck, it will be a hand puppet duck:

Quack

Lovely, isn't it?

Why a duck? Why not a lion?

Good question. :) I always like to provide examples with ducks when I write answers. To my surprise, the theme got a very positive feedback from the community and it spread to everybody. Of course, a lion would be better, but hey, it's free! And it's a duck! :)

Why a hand puppet?

I have absolutely no idea. But since I got this duck, I thought it would be a good idea to start a contest! :)

Rules

  • To win the duck you must guess a number in the range 1-200. The first person who guesses the right number gets the duck.
  • Contestants may submit 2 valid guesses.
  • Please post your guess as an answer to this meta question, not as a comment.
  • Contestants must have been a member of TeX.sx before 21 December, 2013.

The lottery

I'll use the following code to pick the winner:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{expl3}
\usepackage{xparse}

\usepackage{pgf}
\pgfmathsetseed{\number\pdfrandomseed}

\ExplSyntaxOn

\prop_new:N \g_duck_contest_prop
\int_new:N \g_duck_contest_upper_limit_int
\bool_new:N \l_duck_contest_winner_bool
\bool_set_false:N \l_duck_contest_winner_bool
\tl_new:N \l_duck_contest_winner_tl
\int_new:N \l_duck_contest_winning_number_int

\NewDocumentCommand { \person } { m m }
{
    \clist_map_inline:nn { #1 }
    {
        \prop_if_in:NnTF \g_duck_contest_prop { ##1 }
        {
            Hey! ~ #2 ~ wants ~ to ~ be ~ naughty! ~
            The ~ number ~ ##1 ~ was ~ already ~ chosen! \par
        }
        {
            \prop_gput:Nnn \g_duck_contest_prop { ##1 } { #2 }
            \int_gset:Nn \g_duck_contest_upper_limit_int
            {
                \int_max:nn { \g_duck_contest_upper_limit_int } { ##1 }
            }
        }
    }
}

\NewDocumentCommand{ \winner } { }
{
    \bool_do_until:Nn \l_duck_contest_winner_bool
    {
        \pgfmathrandom{1, \g_duck_contest_upper_limit_int}
        \prop_get:NoN \g_duck_contest_prop { \pgfmathresult } \l_duck_contest_winner_tl
        \quark_if_no_value:NF \l_duck_contest_winner_tl
        {
            \bool_set_true:N \l_duck_contest_winner_bool
        }
    }
    \int_set_eq:NN \l_duck_contest_winning_number_int \pgfmathresult
    \l_duck_contest_winner_tl
}

\cs_generate_variant:Nn \prop_get:NnN { No }

\NewDocumentCommand{ \winningnumber } { }
{
    \int_to_arabic:n \l_duck_contest_winning_number_int
}

\ExplSyntaxOff

\begin{document}

% add yourself here
% ==============================
% For example, in the following line
% I picked 1 and 27, but I'm not
% participating in the contest :)
% \person{1,27}{Paulo Cereda}

\person{137,143}{Marco Daniel}
\person{65,105}{Ethan Bolker}
\person{68,130}{giordano}
\person{123,77}{Werner}
\person{124,100}{Stiff Jokes}
\person{15,97}{David Carlisle}
\person{22,44}{egreg}
\person{42,37}{tohecz}
\person{108,69}{Count Zero}
\person{47,167}{ppr}
\person{26,2}{marczellm}
\person{3,30}{Papiro}
\person{131,144}{percusse}
\person{33,66}{Harish Kumar}
\person{1,200}{Przemysław Scherwentke}
\person{4,5}{Frank Mittelbach}
\person{13,93}{Adam}
\person{23,177}{cgnieder}
\person{11,121}{texenthusiast}
\person{50,52}{Peter LeFanu Lumsdaine}
\person{14,29}{ricmarques}
\person{117,183}{Newb}
\person{82,88}{Francesco Endrici}
\person{122,171}{Claudio Fiandrino}
\person{17,21}{Dror}
\person{153,154}{topskip}
\person{74,147}{Sigur}
\person{193,38}{ComFreek}
\person{113,31}{Wayne Werner}
\person{6,7}{Andrew Stacey}
\person{12,171}{azetina}
\person{8,63}{Ignasi}
\person{28,99}{Andrea L.}
\person{25,116}{Benedikt Bauer}
\person{126,129}{Alan Munn}
\person{99,199}{lvaneesbeeck}
\person{197,53}{Pouya}
\person{20,125}{afrendeiro}
\person{45,152}{kan}
\person{114,115}{Philip}
\person{24,133}{doncherry}
\person{27,35}{Yori}
\person{79,186}{knut}
\person{12,173}{fifaltra}
\person{28,196}{Michael Hoppe}
\person{94,81}{XZS}
\person{10,172}{OSjerick}
\person{56,163}{laxxy}

% there was an entry to the code, but not as
% a proper answer, I'm sorry
% \person{8,9}{Joe Corneli}
% ==============================

% the announcement
The winner is \winner, with \winningnumber! Congratulations!

\end{document}

I'll run this code with all the contestants, post a video of it and announce the winner.

The date

Hopefully, I'll get the code running on January 1st, 2014, and announce the winner. :)

Good luck! :) And by the way, welcome to TeX.sx, the friendliest and most awesome community in the whole StackExchange network! They give us hats, right? We give ducks!


----------------------------------------------------------------------------------
|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|009|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|016|◖■◗|018|019|◖■◗|
----------------------------------------------------------------------------------
|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|032|◖■◗|034|◖■◗|036|◖■◗|◖■◗|039|040|
----------------------------------------------------------------------------------
|041|◖■◗|043|◖■◗|◖■◗|046|◖■◗|048|049|◖■◗|051|◖■◗|◖■◗|054|055|◖■◗|057|058|059|060|
----------------------------------------------------------------------------------
|061|062|◖■◗|064|◖■◗|◖■◗|067|◖■◗|◖■◗|070|071|072|073|◖■◗|075|076|◖■◗|078|◖■◗|080|
----------------------------------------------------------------------------------
|◖■◗|◖■◗|083|084|085|086|087|◖■◗|089|090|091|092|◖■◗|◖■◗|095|096|◖■◗|098|◖■◗|◖■◗|
----------------------------------------------------------------------------------
|101|102|103|104|◖■◗|106|107|◖■◗|109|110|111|112|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|118|119|120|
----------------------------------------------------------------------------------
|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|◖■◗|127|128|◖■◗|◖■◗|◖■◗|132|◖■◗|134|135|136|◖■◗|138|139|140|
----------------------------------------------------------------------------------
|141|142|◖■◗|◖■◗|145|146|◖■◗|148|149|150|151|◖■◗|◖■◗|◖■◗|155|156|157|158|159|160|
----------------------------------------------------------------------------------
|161|162|◖■◗|164|165|166|◖■◗|168|169|170|◖■◗|◖■◗|◖■◗|174|175|176|◖■◗|178|179|180|
----------------------------------------------------------------------------------
|181|182|◖■◗|184|185|◖■◗|187|188|189|190|191|192|◖■◗|194|195|◖■◗|◖■◗|198|◖■◗|◖■◗|
----------------------------------------------------------------------------------

◖■◗

Update

Duck winner

Congrats to Dror for picking 17, the winning number! And thanks to all that joined the contest! Happy New Year! Here's the video with me running the code. :)

closed as off-topic by Joseph Wright Dec 31 '13 at 23:01

  • This question does not appear to be about TeX - LaTeX Stack Exchange or the software that powers the Stack Exchange network within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Gambling is not good for children. – kiss my armpit Dec 22 '13 at 18:48
  • @StiffJokes: maybe it teaches a valuable lesson: do not gamble. Not even once. :) – Paulo Cereda Dec 22 '13 at 18:56
  • 7
    Nine nine nine nine nine nine. – Qrrbrbirlbel Dec 22 '13 at 23:42
  • @Qrrbrbirlbel: LOL if you check some of the previous reviews of the code, you'll see David's optimization, which employs quite the same implementation of Dilbert's. :P – Paulo Cereda Dec 23 '13 at 10:46
  • 1
    4 - the IEEE vetted random number (according to XKCD's hovertext) – Wayne Werner Dec 23 '13 at 20:15
  • \begin{equation}\pi\end{equation} – Kartik Dec 27 '13 at 8:02
  • 1
    4 numbers per person might be useful to finalize this game much faster. – kiss my armpit Dec 28 '13 at 20:19
  • Am I supposed to edit the code above so that I'm in it? Because I can't. Does that mean I can't take part in the lottery? – fifaltra Dec 29 '13 at 0:28
  • With no better way to close competitions, 'off-topic' it is: the competition is now closed to new entries, and a winner will be announced (edited in/accepted) soon. – Joseph Wright Dec 31 '13 at 23:01
  • Interesting things about the video: (1) You failed to highlight your code from top to bottom so you needed to do it from bottom to top. (2) Sadly, even you did not use arara to compile the code. :-) – kiss my armpit Jan 1 '14 at 23:12
  • @JosephWright: How long do we have to wait for closing this question? Or should it be in "on hold" status forever? – kiss my armpit Jan 5 '14 at 19:17
  • @StiffJokes The 'on hold' business lasts a week: it's there because there was a feeling that 'closed' was too 'final' in general. It's not something that's selectable for individual questions: closing puts them on hold for one week then they show closed. – Joseph Wright Jan 5 '14 at 22:02

47 Answers 47

4

Mmh... I hope that FakeNameGenerator will grant me some luck!

Number One:28

Number Two:99

Happy Christmas Eve!
\bye
4

25, because it's today's date. And 116 because I need another number!

4

My numbers:

Number 1: 126

Number 2: 129

Not random, not chosen by Emacs.

4

Number 1: 1

Number 2: 200

Neither random nor probable.

Edit

They were already taken :/

So my new choices:

Number 1: 197

Number 2: 53

P.S. Have you noticed how every one is biased toward prime numbers!?

4
  1. 20
  2. 125

This is a long answer now :)

4
  • Number 45

  • Number 152

I was the winner last time. And, I want ducks too :-)

4

Juhu! My first answer in the tex community, 114, 115.

4

Number one: 24
Number two: 133

4

27 and 35 because my current reputation is 2735.

  • Darn, my reputation changed. Can I still change my choice of numbers ? :) – yyzz Dec 31 '13 at 11:57
3

Number 1: 82

Number 2: 88

Very nice idea!

3

Number 1: 122.

Number 2: 171.

3

I wanted to take 3 and 6 (the age of my children who would love the duck). But the numbers are already away.

So I take:

79 and 186

I used a random function with check for already used numbers.

3

This sounds fun! I will go for 12 and 173.

3

Well, my lucky numbers are 28 and 196.

3

As I mostly deal with TikZ, I let PGF handle the job for me.

\documentclass{standalone}
\usepackage{pgf}
\begin{document}
  \pgfmathtruncatemacro{\first}{random(1, 200)}
  \pgfmathtruncatemacro{\second}{random(1, 200)}
  \textbackslash{}person\{\first,\second\}\{xzs\}
\end{document}

\person{94,81}{xzs}

3

My fantastic lucky numbers are: 010 and 172.

1

56, 163. Quack, quack, quack, quack!!

Not the answer you're looking for? Browse other questions tagged .