From: Simon Tatham Date: Fri, 14 Mar 2014 23:01:06 +0000 (+0000) Subject: Generate output the right way round! X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b983fab1cbb6d684019c778baec6c9091816471b;p=matchsticks-search.git Generate output the right way round! --- diff --git a/partition.py b/partition.py index b539d32..4e2766d 100755 --- a/partition.py +++ b/partition.py @@ -145,10 +145,10 @@ def search_and_report(n, m): d = best[1] print "%d into %d best min fragment found: %s" % (n, m, best[0]) print " Cut up %d sticks of length %d like this:" % (n, m) - for row, count in sorted(best[2].items(), reverse=True): + for row, count in sorted(best[3].items(), reverse=True): print " %d x (%s)" % (count, " + ".join([str(Fraction(k,d)) for k in row])) print " Reassemble as %d sticks of length %d like this:" % (m, n) - for col, count in sorted(best[3].items(), reverse=True): + for col, count in sorted(best[2].items(), reverse=True): print " %d x (%s)" % (count, " + ".join([str(Fraction(k,d)) for k in col])) def main():