Prolog code that I wrote when I was a student at Uni. Old code :)