這裏是我的序言代碼:幾何比喻,爲什麼我沒有得到更多的答案?
figure(1, middle(circle, circle)).
figure(2, top_left(circle, circle)).
figure(3, bottom_right(circle, circle)).
figure(4, middle(square, square)).
figure(5, top_left(square, square)).
figure(6, top_right(square, square)).
figure(7, bottom_right(square, square)).
figure(8, bottom_left(square, square)).
relate(F1, F2, Relation) :-
( figure(F1, middle(X, Y)), figure(F2, middle(Y, X)), F1 \== F2 ->
Relation = invert
; figure(F1, middle(X, X)), figure(F2, middle(Y, Y)), F1 \== F2 ->
Relation = same_in_out
; figure(F1, top_left(X, X)), figure(F2, bottom_right(Y, Y)), F1 \== F2 ->
Relation = opposite
; figure(F1, top_right(X, X)), figure(F2, bottom_left(Y, Y)), F1 \== F2 ->
Relation = opposite
; relate(F2, F1, Relation)
).
analogy((F1, F2), (F3, X)) :-
relate(F1, F2, Relation), relate(F3, X, Relation).
代表此設置
這裏是一個簡單的執行:
| ?- relate(2, X, Y).
X = 3
Y = opposite;
no
| ?- relate(2, 7, X).
X = opposite;
no
我的問題是,爲什麼我沒有X = 7,Y =相反,當我涉及(2,X,Y)?
謝謝。
你能想出一個更具描述性問題的標題嗎? – ObscureRobot