Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tlug: Raffle and T-Shirt




Hi,
Jim Schweizer (TLUG Webmaster) contributed a raffle program
in Perl.  The program is included below for people to judge
the randomness and test it out.  I figure that even if we
used a beer mug, it is not that random since some pieces
don't get mixed up as much.  If there is a problem with
the randomness, send me a personal e-mail at
craig@example.com  

I do not plan to issue tickets.  Instead, I will input 
the names in an ASCII file line by line.  The cost is 500 yen
per line.  In theory, each line has an even chance of
being generated.  

The first person drawn will get the first pick of what they
want from the prizes.  The second person will get second
pick.  This will continue until all prizes are exhausted.
Everyone at the meeting will get a penguin sticker, regardless
of whether you buy a ticket or not.  

All money will be donated to TLUG.  I'll try to bring in
the bank book so people can verify the last balance, I think
it was 5,000 yen or something.  Sorry, I don't have it with
me right now or I would get a current listing from machine.

I would like to solicit opinions to see if TLUG should sell
more than one ticket (line in ASCII file) per person.  My
opinion is that this is okay, since all the money is being
donated to TLUG.  However, I'm interested in other opinions.


T-Shirt
-------

If anyone can draw, please bring a drawing of a TLUG single
color T-Shirt design entry.   We don't have any official
entries right now.  We do have one on a napkin that changes
the TLUGer into a computer system and makes the person's head
the monitor.


------------ Raffle Program ------------------


#!/usr/bin/perl -w 
use strict
srand( time() ^ ($$ + ($$ << 15)) );

# The list file should contain the name of each ticket buyer.
# There can be as many different raffles as you want - just
# write a new list for each one or reuse a list.
# The format of the list file is one name per line.

print "\nWhat is the name of your list file? ";
chomp($ticket = <STDIN>);

# Get the ticket buyers from the file.
open(FILE,"$ticket") || die "Can't find the file you typed!\n\n";
@example.com = <FILE>;
close(FILE);

print "\nLet's get started.\n\n";

# Find out what the prize is.
print "What prize do you want to give away? ";
chomp ($prize = <STDIN>);

print "\nIf you wish to pick a name use 'yes' or 'y'.\n\n";

@example.com = ("Shall we pick a name? ",
            "Let's get a winner? ",
            "Pick a $prize winner? ",
            "Grab a name from the hat? ",);

while () {
# get a prompt
$prompt = rand(@example.com);
print "$prompts[$prompt]";
chomp ($more = <STDIN>);
if ($more =~ m/\byes\b|\by\b/){ 

        # get a winner from @example.com 
        $win = rand(@example.com);
        chomp ($win);

        # print the random winner 
        print "\nGive a $prize to $cooldudes[$win]\n";

        # take the winner out of the array
        splice(@example.com, $win, 1);

        # check to see if any cool dudes remain
        if (@example.com >0){
                # see how many are left
                $numdudes = (@example.com); 
                print "There are still $numdudes of you waiting.\n\n"; 
                }
        else{
                # or wrap it up
                print "\aThat's all folks.\n\n";
                exit
                }
        }
else{
# not a 'yes' or 'y' input so we're leaving
die "\a\nThanks for playing.
Too bad:
@example.com
didn't get a $prize.\n\n";
        }
}

---------------------------------------------------------------
TLUG Meeting Dec. 13, 12:30 at Tokyo station Yaesu Chuo ticket gate
13:30 Starbuck's coffee.  13:45 HSBC | info: joem@example.com
At least 3 functional Sparc IPC machines will be raffled out
---------------------------------------------------------------
a word from the sponsor:
TWICS - Japan's First Public-Access Internet System
www.twics.com  info@example.com  Tel:03-3351-5977  Fax:03-3353-6096



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links