user520621
user520621

Reputation:

Why is this prolog program not compiling?

I have a prolog program. These lines are preventing it from 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),
(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

I get the following errors:

| ?- [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

Upvotes: 1

Views: 1624

Answers (1)

Fred Foo
Fred Foo

Reputation: 363707

/= is not a valid operator. You must have meant \=.

(Better yet, use dif(A,B) if your Prolog supports it, and put the dif calls before the rest of the clause.)

Upvotes: 2

Related Questions