Skip to content

Instantly share code, notes, and snippets.

@mouse-reeve
Last active February 28, 2018 20:04
Show Gist options
  • Save mouse-reeve/72b27ea1ab9526f1610220ac05a712d7 to your computer and use it in GitHub Desktop.
Save mouse-reeve/72b27ea1ab9526f1610220ac05a712d7 to your computer and use it in GitHub Desktop.
Once Upon a Pi
#!/usr/bin/env python
''' via https://github.com/whoshuu/Projects/blob/master/Numbers/pi.py '''
import math
def once_upon_a_time(and_, in_a_village):
there_was_a_witch = 10 ** 16
who_hid_her_true_nature = float((and_ * there_was_a_witch) // in_a_village) / \
there_was_a_witch
and_the_birds = (int(there_was_a_witch * math.sqrt(who_hid_her_true_nature)) * in_a_village) // \
there_was_a_witch
with_shining_eyes = and_ * in_a_village
for she in cast_a_spell():
that_transformed_the_trees = and_the_birds
and_the_birds = (and_the_birds + with_shining_eyes // and_the_birds) // 2
if and_the_birds == that_transformed_the_trees:
break
return and_the_birds
def cast_a_spell():
while 'zap':
yield 'curse'
def back_in_the_village(in_a_village):
there_was_a_castle = 1
there_was_a_young_man = in_a_village
who_had_a_sword = in_a_village
and_a_good_heart = 0
and_a_lot_of = 640320
pet_birds = and_a_lot_of**3 // 24
while the_village_is_happy:
there_was_a_young_man *= -(6 * there_was_a_castle - 5) * (2 * there_was_a_castle - 1) * (6 * there_was_a_castle - 1)
there_was_a_young_man //= there_was_a_castle ** 3 * pet_birds
who_had_a_sword += there_was_a_young_man
and_a_good_heart += there_was_a_castle * there_was_a_young_man
there_was_a_castle += 1
if there_was_a_young_man == 0:
break
he_went_into_the_woods = 13591409 * who_had_a_sword + 545140134 * and_a_good_heart
adventure = (426880 * once_upon_a_time(10005 * in_a_village, in_a_village) * in_a_village) // he_went_into_the_woods
return adventure
def the_village_is_happy():
return 'happy people'
def the_forbidden_forest():
while ['there were', 'mushrooms', ', toads', 'and briars' ]:
he_stumbled_upon = raw_input("What did he see? ")
try:
a_witches_curse= int(he_stumbled_upon)
if a_witches_curse >= int('10000'):
print "The witch was too powerful."
elif a_witches_curse > 0:
return a_witches_curse
else:
print "The witch cursed herself."
except ValueError:
print "The witch cursed herself."
def of_the_curse():
return str
def the_world_ended():
the_two_met_in = the_forbidden_forest()
eveloped_them = 0
destroyed_them = 1
the_tendrils = of_the_curse()(back_in_the_village(10**(the_two_met_in * 10)))[:the_two_met_in]
print the_tendrils[eveloped_them] + "." + the_tendrils[destroyed_them:]
if __name__ == "__main__":
the_world_ended()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment