-
-
Save jwatzman/5c25aa6732e849df13e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
def p(passnum, num): | |
return "$p%d_%d" % (passnum, num) | |
print """<?php | |
function f(&$x, &$y, $z) { | |
$x += $z; | |
$y += $z + 1; | |
$y = (string)$y; | |
} | |
class C { | |
public function get() { | |
return (float)$GLOBALS['p0_0']; | |
} | |
} | |
""" | |
pnum_max = 150 | |
for pnum in range(0, pnum_max): | |
if pnum == 0: | |
print "$p0_0 = 1;" | |
else: | |
print "%s = %s + 1;" % (p(pnum, 0), p(pnum - 1, 0)) | |
print "%s = new C();" % (p(pnum, 1)) | |
print "%s = %s->get() * 0.95;" % (p(pnum, 2), p(pnum, 1)) | |
print "%s = array(%s, %s);" % (p(pnum, 3), p(pnum, 2), p(pnum, 0)) | |
print "f(%s, %s, %s);" % (p(pnum, 0), p(pnum, 2), p(0, 0)) | |
print "%s = array_sum(%s);" % (p(pnum, 4), p(pnum, 3)) | |
if pnum % 5 == 4: | |
print "%s = sqrt(%s);" % (p(pnum, 4), p(pnum, 4)) | |
print "%s = %s;" % (p(pnum, 0), p(pnum, 4)) | |
print "" | |
#print "var_dump($GLOBALS);" | |
print "$final_arr = array(" | |
for pnum in range(0, pnum_max): | |
print " %s / 4," % p(pnum, 4) | |
print ");" | |
#print "var_dump($final_arr);" | |
print "$final = array_product($final_arr);" | |
print "echo \"$final\\n\";" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment