Thread: Wish Software
View Single Post
mathogre

 
mathogre's Avatar
 
Member Since: Jan 20, 2007
Location: Oakton, VA USA
Posts: 3,269
mathogre has a brilliant futuremathogre has a brilliant futuremathogre has a brilliant futuremathogre has a brilliant futuremathogre has a brilliant futuremathogre has a brilliant futuremathogre has a brilliant futuremathogre has a brilliant futuremathogre has a brilliant futuremathogre has a brilliant futuremathogre has a brilliant future
Mac Specs: White MacBook Intel C2D 2.2GHz, 2G, 250G, SD, Leopard.

mathogre is offline
This is the software being considered for use in the "Wish" thread:

A Wish for a Special Child....

The software is here:

http://homepage.mac.com/mathogre/.Pictures/touch_08.py

It is a command line program written in Python. It uses the version of Python built into the latest version of OS X, 10.4.10. The version of Python is 2.3.5. While newer versions of Python are available, I chose to go with what is in OS X.

Download the softare to your desktop. After you download it, do an md5 check on it. Open Terminal and type the following on the command line:

md5 touch_08.py

You should get a result like this:

MD5 (touch_08.py) = 105388ae8172326cef18a353ad8d78f3

If you do, then your download worked properly. If not, then your download did not work.

This is NOT the final version of the software. However, you should try it to see how it works.

Type the following on the command line:

/usr/bin/python ~/Desktop/touch_08.py

This will start the program.

Below you will find the opening comment section from the program. You can read the code with any text editor and see exactly what is in it. The program is neither long nor complicated. Please feel free to challenge anything that does not seem right!

## This program chooses names in the drawing run by macjuicy23 for an
## Apple Store credit and for an iPod touch. The names are stored in a
## list, once for each ticket they bought. A user enters a closing stock
## figure as the random number seed for a stock group or single stock
## chosen on the previous day. The Apple Store credit is chosen first,
## and the winning ticket is removed from the list. The iPod touch is
## chosen second, and the winning ticket is removed from the list.
##
## To run the program, place this program on your desktop, run Terminal,
## and enter the following command into Terminal:
##
## /usr/bin/python ~/Desktop/touch_08.py
##
## This will start the program.
##
## You will first see a greeting, and a request to enter the stock price.
## For instance, on a Monday, someone may decide the drawing will occur
## the next day, and that the closing Apple stock price for Tuesday as
## reported on an iPhone will be used to seed the program. This is where
## you'll enter it.
##
## Note that the random number generator is very sensitive to inputs. A
## one cent difference ($0.01) can radically alter results. In addition
## to the unpredictability of stock prices from day to day, no one can
## second guess the results. Feel free to experiment!
##
## After entering the stock price, you are shown what you entered, and
## are allowed to either press the return key to continue or enter ctrl-d
## to exit the program.
##
## Assuming you've properly entered the stock price, you are then
## prompted to press the return key to see what tickets are in the
## drawing. I've taken everything almost exactly as in the forum thread.
## In one case I had to add a back slash - a character escape - to allow
## for a single quote that appeared in the forum list.
##
## One line exists for each ticket. People who bought multiple tickets
## are shown multiple times. This is simply for validation.
##
## Now it's time for the drawing. You are prompted to press the return
## key to see who wone the Apple Store credit. The program randomly
## chooses an entry from the ticket list (a Python list named ticketList)
## and prints the result.
##
## You are then prompted to press the return key to see the list of
## tickets remaining in the drawing. The program takes the winning
## ticket and removes it from the ticket list. The remaining entries are
## displayed.
##
## Note that a person with two or more tickets could potentially win both
## prizes. Only the winning ticket is removed.
##
## The next prompt for the return key is for the iPod touch. As before,
## the program randomly chooses an entry from the ticket list and prints
## the result.
##
## Finally you are prompted to see the remaining list of tickets that did
## not win. The winning entry is removed from the list when you press
## return, and the remaining tickets are displayed.

Evil Math Ogre Kgh-Ra
Integrate me. Differentiate me.
You can't hurt me. I'm e^x. Ha ha ha!

Homepage | Gallery
I was on the M-F honor roll for July 2007.
QUOTE Thanks