我想查看来自findall/3
查询的响应,并且我想选择等于“ Entered”编号的test()。这是我的代码:
test1:-
%enter in number to be read
writeln('Enter grid reference for where you would to place your X (1-9)'),
%read in the number
read(Entered),
%find all in 'test()' where the entered number equals the correct test() instance
findall(Entered,test([A,B,C,D,E,F,G,H,I],Entered = Entered),Y),
%write out the results
writeln(Y).
test(['1','_','_','_','_','_','_','_','_'],1).
test(['2','_','_','_','_','_','_','_','_'],2).
test(['3','_','_','_','_','_','_','_','_'],3).
test(['4','_','_','_','_','_','_','_','_'],4).