level 5
kgisme169
楼主
judge(Answer,IfAction,Action):-IfAction=Answer,Action="kill".
judge(Answer,IfAction,Action):-not(Answer=IfAction),Action="kill".
finalJudge(Answer,Action):-judge(Answer,Action,Action).%
上述内容保存成.pl文件,用swiprolog打开,Compile buffer,然后在命令行里面运行:
1 ?- finalJudge
% c:/Documents and Settings/zhang/My Documents/my1.pl compiled 0.00 sec, 0 bytes
1 ?- finalJudge("burn",Action).
false. 2 ?- finalJudge("kill",Action).
Action = [107, 105, 108, 108]
为什么finalJudge("kill",Action)得到是一堆没有意义的
2012年03月19日 12点03分
1
judge(Answer,IfAction,Action):-not(Answer=IfAction),Action="kill".
finalJudge(Answer,Action):-judge(Answer,Action,Action).%
上述内容保存成.pl文件,用swiprolog打开,Compile buffer,然后在命令行里面运行:
1 ?- finalJudge
% c:/Documents and Settings/zhang/My Documents/my1.pl compiled 0.00 sec, 0 bytes
1 ?- finalJudge("burn",Action).
false. 2 ?- finalJudge("kill",Action).
Action = [107, 105, 108, 108]
为什么finalJudge("kill",Action)得到是一堆没有意义的