This is the software being considered for use in the "Wish" thread:
The software is here:
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:
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:
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
## 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.
As Python is not my native tongue, I found this helpful when reading over the code. (Yup...I have no life.)
Thank you technologist! I use that Python reference all of the time.
It works PERFECTLY!!!!! FANTASTIC JOB Math!!!!!!
For those that aren't very Terminal Savvy...
To verify the download was successful (it will be) using md5.... you'll need to open the terminal and either:
type cd Desktop (press enter) THEN type md5 touch_08.py (press enter)
Open the terminal type md5 and then press the space bar then drag and drop the file onto the Terminal window, thus showing the file path.... then press enter.
Thank you RIDE!
Oh and sorry about the md5 instructions. I get typing so fast and think that everyone works on the command line, so I forget some things. O:)
The latest version of the software, v10, can be found here:
md5 check should give this as a result:
MD5 (touch_10.py) = 9fe6d04dbbab30baa51c4b4d9efd8ac8
To see the difference between the prior version and this version, in Terminal on the command line type:
diff touch_08.py touch_10.py
It should give you this result:
The little codes like 14c14 indicate that differences in line 14 in the first file corresponds to differences in line 14 in the second. The left arrow "<" shows the line(s) in the first file, while the right arrow ">" shows the line(s) in the second file.
As you can see, one change is for how to run the program, using the latest version number or the program. The remaining changes are simply for the current participants.
Hope this helps!
I actually like that program for fun :P
It's time for a dry run. Here are five "seeds" to try. The first one is the closing price of Apple stock on Friday Oct. 12, 2007. Both the iPhone and the Charles Schwab website show the same price. The next two seeds are one cent below and above, respectively. The last two are just other values to try.
With each seed, I've included the winning results, based on running version 10, touch_10.py. Instructions above give details on how to run this, but here's the command to run in Terminal, assuming you've saved the program to the desktop:
Once you've run this, please report the following results:
a) What type of machine are you running? MacBook? iMac?
b) What version of OS X are you running? I've allowed that this is intended to use the version of Python that ships with OS X 10.4.10 only.
c) Did all of your results match what I've poste? If not, what differences did you get?
THIS IS A TEST.
1. seed = 167.25
Congratulations! $20.00 Quiara: (mac-Forums) is the winner of the Apple Store credit.
Congratulations! $20.00 babarnette (Mac-Forums) is the winner of the iPod touch.
2. seed = 167.24
Congratulations! $10.00 Brandon: (mac-Forums) is the winner of the Apple Store credit.
Congratulations! $40.00 RMAN (Mac Forums) is the winner of the iPod touch.
3. seed = 167.26
Congratulations! $30.00 RIDE (Mac-Forums) is the winner of the Apple Store credit.
Congratulations! $40.00 RMAN (Mac Forums) is the winner of the iPod touch.
4. seed = 100.00
Congratulations! $10.00 Mylo (mac-forums) - I wil SHip no worries anywhere in us is the winner of the Apple Store credit.
Congratulations! $40.00 Mathogre (Mac-Forums) is the winner of the iPod touch.
5. seed = 200.00
Congratulations! $10.00 nokialed (mac Forums) is the winner of the Apple Store credit.
Congratulations! $10.00 XMARLTONX (Mac-Forums) is the winner of the iPod touch.
Wow MO! That's some amazing work you did! I haven't tested the program but I have total faith in you! :D
The final version of the code for the drawing is here:
If you run the md5 check on it, here's the command and the subsequent result:
MD5 (touch_12_final.py) = ff36c05fa4f6e2046d60e0587045cc52
If you save the program to the Desktop, run it with this command:
The program has been updated with the final list of people in the drawing as posted by RIDE in the main thread. Below is the difference report from the prior version of the code. Note that the only differences are in the comment regarding how to run the program, and in the names of the people in the drawing. Because of ordering and formatting differences in the list of people, you'll first find the list of participants as included in the program, followed by the differences report.
Enjoy and good luck!!!!
Absolutely flawless!!! Great Job Math!!! Thank you for the time and effort you've put into this!!! Well done!!!!
Thank you RIDE. It was fun!
|All times are GMT -4. The time now is 03:24 PM.|
Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.