Tagged as: Amusing, Geek, life in code, Personal, Python, Useful
Nov
05
# use_public_toilet.py
#
# Algorithm for using a public toilet. Success will vary based on the
# toilet/situation (obviously). However, this seems to be a generally safe
# way to approach using a toilet.
#
# Handles both male and female needs as well as exceptional cases such as
# no available toilet, getting dirty, and entering the wrong gender's
# bathroom.
#
# Algorithm is roughly:
# 1) Enter bathroom
# 2) Find suitable toilet
# 3) Protect yourself if it's a stall toilet that you sit on
# 4) Do your business
# 5) Finish up
import common_sense
# Sometimes even nature's calling cannot overrule common sense
# Including when you walk into the wrong bathroom
if (bathroom.is_disgusting or bathroom.is_dangerous
or bathroom.gender != you.gender):
you.hold('your waste')
return # (i.e., get out of there!)
my_toilet = None
# Only male urinaters get to use the urinals, at least in the common case
# (Abnormal cases are unhandled here)
if you.need() == 'urinate' and you.gender == 'male':
for urinal in bathroom.urinals:
if not urinal.empty:
continue
my_toilet = urinal
# If you are not a male urinating or there is no urinal available
if my_toilet is None:
# Time to look for the stall
for stall in bathroom.stalls:
# Use an empty toilet that can also be initialized to a clean state
if not stall.empty or (not toilet.clean and not toilet.works):
continue
you.enter('Stall %s' % stall)
my_toilet = stall
break
else:
# You could not find a suitable stall to use
return
you.wipe('toilet seat')
you.put('toilet seat cover')
while not toilet.seat_covered():
you.put('toilet paper')
# Finally the time has come to get down to business
try:
you.sit()
you.do_your_business()
except TouchDirtyException: # Don't touch the toilet!
you.cry()
you.flush(my_toilet)
you.wash_hands()
you.leave()
if you.satisfied: # Be happy, you're done
you.smile()
Tagged as: Christianity, Life, life in code, Seen-Around
Aug
21
Marriage_Dating.py
too_long = 730 # days, which is 2 years
while you.engaged == False:
# What state are you in?
if you.dating == False:
days_dating = 0
if you.find('PERSON')
you.dating = True
other_person = person_of_opposite_sex()
else:
days_dating += 1
# Date day, hooray!
if you.have('DATE'):
# Here's the juice
if dating.purpose == 'MARRIAGE':
result = you.go('DATE', 'INTERESTING', other_person)
if days_dating >= too_long:
you.dating = False
else:
result = you.go('DATE', 'BORING', other_person)
# Process the result of the date
if result == 'WELL':
pass # Just keep on going on those dates!
elif result == 'ENGAGED':
you.engaged = True
else:
you.dating = False
# Every other day of your (obviously) interesting life
else:
you.go('WORK')
you.go('HOME')
you.go('WEDDING')
other_person.go('WEDDING')
you.married = True
other_person.married = True
you.celebrate()
other_person.celebrate()
README
Here’s some help for understanding this snippet of Python programming code. While you are unmarried, you are either dating someone or you are not. If you’re not dating and happen to find someone that you want to date, then lucky you! The next categorization is you are either actively pursuing marriage or you are not. If you are, I think that you should want to go on interesting dates.
Life isn’t dinner and a movie. Life is crazy and uncertain. It’s hard and difficult. Don’t you want to see how the person that you might spend the rest of your life with reacts? When they’re fording a river, do they get angry and upset with you? When you’re lost in the wilderness, do they get upset and frustrated? When you get frustrated with them, do they snap back? Find the worst in the person. Look for it as hard as you possibly can. Because if you can handle the worst, then you can definitely handle the best.
If you aren’t as actively pursuing marriage then enjoy your dinner and movie.
And if you’re not dating then good luck with being on your own and all of the issues entailed in CT’s The Case For Early Marriage.
Tagged as: life in code, Political
Jan
21
while(date < '2013-01-20')
if (date == '2009-01-20')
crowd.release(pomp, circumstance)
if (BarackObama != Jesus)
derek.exclaims('Amen to that')
else
work = BarackObama.work()
crowd.judges(work)