1

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

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
4

1 回答 1

2

/=不是有效的运算符。你一定是故意\=的。

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

于 2011-03-31T20:02:18.740 回答