Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Unoptimized, and actually wrong code
# Written to solve problems in my textbook, and does that well
# Don't use, don't judge.
def solve(functions):
def solve_recurse(functions, values, count):
old_values = values[:]
for i in range(len(functions)):
values[i] = f(*values)
print values
if values == old_values:
print "Solved in %s iterations!" % count
else:
solve_recurse(functions, values, count+1)
solve_recurse(functions, [0 for f in functions], 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.