我是Prolog的新手,下面的代码给了我很多错误

时间:2019-11-17 07:44:39

标签: prolog

我试图输入以下代码,但是每次查阅时,都会出现很多错误。感谢您的帮助。

man(marcus).

roman(marcus).

not(man(X)),person(X).

ruler(caesar).

not(roman(X)),loyal(X,caesar),hate(X,caesar).

loyal(X,Y).

not(person(X)),not(ruler(Y)),not(tryassasin(X,Y)),not(loyal(X,Y)). 

tryassasin(marcus,caesar).

错误:test1.pl:3:

Full stop in clause-body?  Cannot redefine ,/2

错误:test1.pl:5:     子句中的句号?无法重新定义,/ 2

警告:test1.pl:6:

Singleton variables: [X,Y]

错误:test1.pl:7:

Full stop in clause-body?  Cannot redefine ,/2

1 个答案:

答案 0 :(得分:0)

我明白了你要做什么。

您的序言基础知识很薄弱。

我强烈推荐这个youtube视频。请注意。 prolog youtube tutorial

希望这对您有所帮助。