Prolog Delay Execution of Text -
i write text based adventure game in prolog, therefore have tons of writeline statements. wondering if slow down output processing of text. imagine following scenario:
i have textblock gets printed , want 2 sec delay afterwards. textblock b gets printed 2 sec later, without :- sign in prolog.
my first idea write loop compares current time currenttime + 2 s cant rid of :- sign.
unfortunately; newbie in prolog , ii don't have clue thread handling.
that statement might useful doesn't work @ all:
delaytext([h|t]) :- put_char(h), flush_output, sleep(0.1), delaytext(t). delaytext([]).
neither flush output nor sleep seem work.
i'm using prodt in eclipse. in advance, chris.
i'm not sure how want realise writing game, sleep/1
used in example code in question can used simple write so:
delaytext([]). delaytext([h|t]) :- write(h), sleep(1), % time in seconds delaytext(t).
Comments
Post a Comment