Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!psuvax1!psuvm!f0o From: F0O@psuvm.psu.edu Newsgroups: comp.lang.prolog Subject: Deterministic predicate question Message-ID: <90239.224751F0O@psuvm.psu.edu> Date: 28 Aug 90 02:47:51 GMT Organization: Penn State University Lines: 32 The build_board predicates will set up a beginning tic-tac-toe board. The predicates work ok, but they are both non-deterministic. However, our old friend length is deterministic. I'm curious as to why length is deterministic where both of the build_board predicates are not. Also, is there a way to make one of the build_board predicates deterministic, without using the cut? build_board1(10). build_board1(SquareNum) :- NextSquare = SquareNum + 1, build_board1(NextSquare), assert(board(SquareNum," ")). build_board2(10). build_board2(SquareNum) :- assert(board(SquareNum," ")), NextSquare = SquareNum + 1, build_board2(NextSquare). length([],0). length([_|T],Len) :- length(T,Tmp), Len = Tmp + 1. Thanks muchly, [Tim]