【发布时间】:2014-01-26 06:14:50
【问题描述】:
好的,我得到了这两个谓词 hangman 和 graphics
fail([]).
hangman:-
getPhrase(Ans),
!,
write('Welcome to hangman.'),
nl,
fail(FailedList),
graphics(FailedList), %<--- The call is made here.
name(Ans,AnsList),
makeBlanks(AnsList, BlankList),
getGuess(AnsList,BlankList, FailedList).
graphics(FailedList):-
length(FailedList, L),
L == 0,
write('-----------'), nl,
write('|'), nl,
write('|'), nl,
write('|'), nl,
write('|'), nl,
write('|'), nl,
write('|'), nl,
write('|'), nl,
write('|'), nl,
write('/\'), nl.
为什么我会收到错误消息:ERROR: hangman/0: Undefined procedure: graphics/1?
请注意,如果我将谓词 graphics 放在 cmets 中的 hangman 内,我的程序就可以正常工作。
【问题讨论】:
-
您忘记了
write/1语句中的结尾'。 -
@Mog 感谢您的帮助,但我仍然收到错误消息。关于它为什么无法识别的任何想法?
-
@Mog 你有答案的功劳,伙计!
-
谢谢你们!非常感谢!
标签: prolog