How to turn off "true" and "false" outputs in Prolog? -
How to turn off "true" and "false" outputs in Prolog? -
i write little text-based adventure game using prolog (this might dumb thought not here discuss that).
the problem can't manage print text on screen without "true" , "false" values appear well.
for instance if seek like:
take(desk) :- write('this thing way heavy me carry!'). where take 1 place predicate , desk name output:
?- take(desk). thing way heavy me carry! true. how can rid of "true" or "false" outputs?
just mention tried format/1 1 place predicate simple text output , format/2 2 place predicate (when want output name of variable) gives same problem.
i have seen this answer first not detailed plenty (at to the lowest degree not me) , second, hope deep within there simpler manner it.
and finally, using swi-prolog.
thank you.
a simplistic method create little repl (read, evaluate, print loop) of own. this:
game :- repeat, write('> '), read(x), call(x), fail. this prompt , execute whatever come in @ prompt. in conjunction take fact (and added illustration):
take(desk) :- write('this thing way heavy me carry!'), nl. take(chair) :- write('this easier carry.'), nl. you get:
?- game. > take(desk). thing way heavy me carry! > take(chair). easier carry. > you don't true or false because game goal doesn't resolve until exit loop somehow. add together checks quit or bye or whatever exit game loop. ctrl-c or ctrl-d can used abort loop. might need add together other "features" create work needs or liking.
prolog swi-prolog prolog-toplevel
Comments
Post a Comment