While attempting to find a programmatic solution to Enigma 1602 (which really is much easier to do with pencil and paper) for the Enigmatic Code Blog, I briefly toyed with the idea of writing my own code to solve sets of linear simultaneous equations.
Then I discovered the rather marvellous SymPy library, which can do that and much more, and made for a very neat solution.
I've really only scratched the surface of this module, but I expect to use it more in the future.
Along with other Python modules that aid in the writing Enigma solutions: unlimited precision integers, set, itertools, collections, fractions, probably lots of other standard modules I have yet to discover, and, of course, my own set of useful routines.
And finally, to squeeze that bit extra out your Python programs you can always try using PyPy, which is a Python interpreter, written in Python. It includes a JIT compiler and often ends up running faster than the standard CPython interpreter.
I tried it on my code for Enigma 1653 - one of the trickier ones - and I got the following runtimes:
CPython 2.7.1: 2m01s
CPython 3.2: 1m52s
PyPy: 0m10s
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment