[Neworleans-pm] Fwd: Perl Quiz-of-the-Week #16
Brett D. Estrade
estrabd at yahoo.com
Wed Jun 23 20:45:41 CDT 2004
On Wed, 23 Jun 2004 21:24:12 -0400, "Jon Bjornstad" <jon at icogitate.com>
said:
>
>
> IMPORTANT: Please do not post solutions, hints, or other spoilers
> until at least 60 hours after the date of this message.
> Thanks.
>
> IMPORTANTE: Por favor, no enviéis soluciones, pistas, o cualquier otra
> cosa que pueda echar a perder la resolución del problema hasta
> que hayan pasado por lo menos 60 horas desde el envío de este
> mensaje. Gracias.
>
> IMPORTANT: S'il vous plaît, attendez au minimum 60 heures après la
> date de ce message avant de poster solutions, indices ou autres
> révélations. Merci.
>
> WICHTIG: Bitte schicken Sie keine Lösungen, Tipps oder Hinweise für
> diese Aufgabe vor Ablauf von 60 Stunden nach dem Datum dieser
> Mail. Danke.
>
> BELANGRIJK: Stuur aub geen oplossingen, hints of andere tips in de
> eerste 60 uur na het verzendingstijdstip van dit
> bericht. Waarvoor dank.
>
> VNIMANIE: Pozhalujsta ne shlite reshenija, nameki na reshenija, i
> voobshe lyubye podskazki v techenie po krajnej mere 60 chasov
> ot daty etogo soobshenija. Spasibo.
>
> Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60
> Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4
> Xie4Lou4 Da2An4 De5 Jian4Yi4. Xie4Xie4.
>
> ----------------------------------------------------------------
>
> For statewide elections, the state of California uses a "random
> alphabetic" sort to order the candidates' names on the ballot. This
> link describes that special sort:
>
> http://www.ss.ca.gov/elections/elections_ra.htm
>
> (mirrored at http://perl.plover.com/qotw/misc/r018/elections_ra.htm )
>
> The idea is this: a random order is selected for the twenty-six
> letters of the alphabet, and then the names on the ballot are sorted
> according to this random order, instead of according to the usual
> order.
>
> This is the order in which the names appear on the ballot in Assembly
> District 1. In Assembly District 2, the order is the same, except
> that the first name on the list has been moved to the end of the list.
> In Assembly District 3, the first name on the list is moved to the end
> of the list, and so on.
>
> You will write a program to generate ballots. The program will be
> invoked like this:
>
> elect.pl [-r] [permutation] [district-number] [namefile]
>
> (Items in [square brackets] are optional.)
>
> The 'permuation' argument will default to 'randlet.txt'. If the file
> exists, it should contain a single line of text with a random
> permutation of the 26 letters of the alphabet. If this file does not
> exist, the program should generate one at random. The -r option will
> force the file to be regenerated even if it exists already.
>
> The 'district-number' is the number of the Assembly District for which
> the ballot will be generated. If omitted, the program should generate
> the ballot for Assembly District 1.
>
> The 'namefile' is a file that contains the names of the candidates.
> The names come one per line with first name then last name:
>
> Jill Harmon
> Gus Tribble
> Walter Reston
> Norma Kretschmer
> Fiorella Squamuglia
> Marv Smith
> Bill Smith
> Ed Squid
> John Macdonald
> Angus MacDonald
>
> If the namefile is omitted, the program should read the names from the
> standard input.
>
> The program should print out the candidates' names, one per line, in
> the order specified by California state law, sorted according to the
> random permutation of the alphabet, with names rearranged as
> appropriate for the specified Assembly District.
>
> For example, if the file 'permutation' contains
>
> QWERTYUIOPASDFGHJKLZXCVBNM
>
> and the 'namefile' contains the names listed above, then the output
> for Assembly District 1 should be:
>
> Walter Reston
> Gus Tribble
> Ed Squid
> Fiorella Squamuglia
> Vern Smith
> Bill Smith
> Jill Harmon
> Norma Kretschmer
> Angus MacDonald
> John Macdonald
>
> For Assembly District 4, it should be:
>
> Fiorella Squamuglia
> Vern Smith
> Bill Smith
> Jill Harmon
> Norma Kretschmer
> Angus MacDonald
> John Macdonald
> Walter Reston
> Gus Tribble
> Ed Squid
>
=====
http://www.brettsbsd.net/~estrabd
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
More information about the NewOrleans-pm
mailing list