gpt4 book ai didi

compiler-errors - 为什么此prolog程序无法编译?

转载 作者:行者123 更新时间:2023-12-02 10:45:42 26 4
gpt4 key购买 nike

我有一个序言程序。这些行阻止其编译:

wins(A,B,C,D) :- convert(A,W), value(W,P), convert(B,X), value(X,Q), 
convert(C, Y), value(Y,R), convert(D,Z), value(Z,S), card(A), card(B), card(C), card(D),
(P+Q)>(R+S), (P+Q)<22, A/=B, A/=C, A/=D, B/=C, B/=D, C/=D. %this is not compiling

wins(A,B,C,D) :- convert(A,W), value(W,P), convert(B,X), value(X,Q),
convert(C,Y), value(Y,R), convert(D,Z), value(Z,S), card(A), card(B), card(C), card(D),
(R+S)>21, (P+Q)<22, A/=B, A/=C, A/=D, B/=C, B/=D, C/=D. %this is not compiling

我收到以下错误:
| ?- [blackjack].
compiling /home/ross/flash/current/CS390/blackjack.pl for byte code...
/home/ross/flash/current/CS390/blackjack.pl:47:25: syntax error: . or operator expected after expression
/home/ross/flash/current/CS390/blackjack.pl:51:22: syntax error: . or operator expected after expression
2 error(s)
compilation failed

最佳答案

/=不是有效的运算符。您一定是\=的意思。

(更好的是,如果您的Prolog支持dif(A,B),则将dif调用放在该子句的其余部分之前。)

关于compiler-errors - 为什么此prolog程序无法编译?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5505596/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com