I recently had to use a timer in a Python-program, and happened to run into a problem with the time.clock() function, which is supposed to be the most accurate [more accurate than time.time()]. The problem was, I found not the accuracy, but rather that clock() seemed to function poorly, when some blocing code, ie. socket.recv() and socket.send() was involved.
tstart = time.clock()
elapsed = time.clock() - tstart
from datetime import datetimetstart = datetime.now()
elapsed = datetime.now() - start
Worked just perfectly.
I’ve been writing a solver for the Eternity 2 puzzle. Here’s a sample, when setting the dimensions to 4×4. The puzzle itself is 16×16.
It’s written in Python, which of course is not the optimal language, but performance wasn’t the goal anyway.
The goal, amongst others, was to explore techniques for solving the puzzle, and to get more into Python.
More to come on this…
The solver now, partially at least, works in a distributed environment, using sockets for communication. Some features that might be handy, if the solver should ever find a solution are missing, but that was never the point of this project anyway. More to come on the distributed solver as well.
I’ve built a small cluster of Raspberry Pi’s for testing: