I came down with a brutal cold this week and did not accomplish as much as I would have liked to. I did make some decent progress, however.
I spent an evening browsing the user documentation for the Myro library, which is a collection of Python functions to send basic commands to the Scribbler. I also worked my way through “Learning Computing With Robots” by Deepak Kumar, a freely-available textbook about using Myro as a platform to learn Python. In the process, I sharped my Python skills and learned my way around Myro.
My other, somewhat more significant advancement this week was successfully integrating Python, Myro and Prolog. I found a hobbyist-made library called PySWIP to facilitate messaging between the Python shell and SWIPl, the implementation of Prolog that I am using. Unfortunately getting this to work turned out to be a nightmare because of dependency and legacy issues… Myro runs best on Python 2.4, while PySWIP requires Python 2.7 and wouldn’t work with newer versions of SWIPL. I had similar issues regarding to 32-bit version versus 64-bit versions.
I could not find any online to solve my quandary– I think I may be the first person to ever try using Prolog to control a Scribbler! After brute forcing my way through several different combinations of versions, eventually I got Myro to run under Python 2.7 by updating all its dependencies manually, and found a version of SWIPL that was compatible with PySWIP.
So now I can import a Prolog file into Python by inputting:
> prolog.consult(‘sample.pl’)
And query it from Python by inputting:
> prolog.query(“male_ancestor(edward_vi, Ancestor)”)
Which returns a Python generator with all of the solutions that Prolog finds. Pretty cool!