Compiling MegaHAL on OS X

From Robert-Depot
Jump to: navigation, search

<<< back to Wiki Home

Build on OS X

Edited from these instructions -

perl -pi -w -e 's/\#include <malloc.h>/\#include <\/usr\/include\/malloc\/malloc.h>/g;' megahal-9.1.1/*.c

  • Force to compile 32 bit
sed -i .bak 's/CFLAGS=/CFLAGS=-m32 /g' megahal-9.1.1/Makefile 


Install mh_python

  • make pythonmodule doesn't work

python build

sudo python build install

Using mh_python

Type "copyright", "credits" or "license()" for more information.
>>> import mh_python as mh
>>> mh.initbrain()
>>> mh.learn("learn from this sentence")
>>> mh.doreply("hello what have you learned?")
'Hello what'
>>> mh.learn("learn from this sentence as well.")
>>> mh.doreply("i am well.")
'Learn from this sentence as well.'