Skip to content

Commit

Permalink
Merge 'geico' (rytonbay/master) from pull request #54
Browse files Browse the repository at this point in the history
With two additional commits affecting the formatting of doc/Geico.txt.

Conflicts:
	setup.py
  • Loading branch information
jgonggrijp committed Nov 4, 2013
2 parents 50aa8d2 + 4bec1f0 commit 3851238
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
27 changes: 27 additions & 0 deletions doc/Geico.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Geico Help:

To see the comic that this command references go to:
http://www.xkcd.com/42/


The Geico command was created by Rytonbay inc. and was sponsored by
The XKCD Community.

The Geico command was designed so that users can spend more than 15
minutes and save more than 15% on insurance. The Geico command was
designed to help you save money on insurance by helping you pick the
best golf club to threaten your agent with. The Geico command has
already saved people thousands of dollars in insurance.

Rytonbay inc. is not responsible for any results of using the Geico
command including but not limited to; lawsuits, bruises, losing more
money than was gained and your Insurance agent not being your friend
anymore. Be careful when using the Geico command because threatening
people with golf clubs can sometimes lead to lawsuits [citation
needed], which can sometimes be expensive [citation needed].

How does it work:

total cost = insurancecost * (1 - (insurance saving percent based on club choice + (strength/100)))


3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@

executable_scripts = [ 'json-parse.py', 'xkcd-fetch.py', 'xkcd-search.py',
'level_up.py', 'summon.py', 'fortune.py', 'godel.py',
'random-number.py', 'rshelp.py' ]
'random-number.py', 'rshelp.py', 'geico.py' ]

python_modules = 'src/xkcd-fetch.py src/level_up.py'.split()

def main ( ):
Expand Down
48 changes: 48 additions & 0 deletions src/Geico.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#! /usr/bin/env python2

# Copyright 2013 Bryton Moeller
# Licensed under the Red Spider Project License.
# See the License.txt that shipped with your copy of this software for details.
# club cost estimates by: http://sports.whatitcosts.com/golf-clubs-pg3.htm

golfbag = {"Putter":[0.1,175],"5iron":[0.15,100],"7iron":[0.17,100],"Wood":[0.22,225],"Driver":[0.26,350]}
# filling the golf bag club %off price
# insurance

# pre-golfclub cost
errorcheck = False
while(errorcheck == False):
try:
errorcheck = True
insurancecost = abs(int(raw_input("How much does your insurance currently cost?: ")))
except ValueError:
print("That's not an integer.")
errorcheck = False
errorcheck = False
print("Putter costs $175 but saves you 10 percent on insurance.")
print("5iron costs $100 but saves you 15 percent on insurance.")
print("Wood costs $225 but saves you 22 percent on insurance.")
print("7iron costs $100 but saves you 17 percent on insurance.")
print("Driver costs $350 but saves you 26 percent on insurance.")
clubchoice = raw_input("Which golf club would you like to use to threaten your agent?: ")
# asks user for club choice and gives info
validchoice = False
while(validchoice == False):
if(clubchoice not in ("Putter", "5iron", "7iron", "Wood", "Driver")):
print("That's not a valid club choice.")
clubchoice = raw_input("Which golf club would you like to use to threaten your agent?\n")
else:
validchoice = True
# making sure the user made a valid club choice
while (errorcheck == False):
try:
errorcheck = True
strength = abs(int(raw_input("How intimidating can you look with a golf club? (1-10): ")))
# gets scaryness data
except ValueError:
print("That's not an integer.")
errorcheck = False
# integer checking
totalcost = str(insurancecost * (1 - (golfbag[clubchoice][0] + (strength/100))))

print("Your insurance will cost $" + totalcost + ", but you will have to pay $" + str(golfbag[clubchoice][1]) + " to purchase your club.\n")

0 comments on commit 3851238

Please sign in to comment.