diff options
-rw-r--r-- | pd_client.pl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pd_client.pl b/pd_client.pl index 94d1ad5..8aaf93b 100644 --- a/pd_client.pl +++ b/pd_client.pl @@ -11,19 +11,19 @@ start(Module, Host, Port):- launch(Module, StreamIn, StreamOut) :- atom_concat('rules/', Module, Path), consult(Path), - do([], StreamIn, StreamOut, Module, [], []). + do(StreamIn, StreamOut, Module, [], []). % -1 = EOF byte_to_atom(-1, e):-!. byte_to_atom(A, B):-name(B, [A]). -do(e, _, _, _, _, _) :- !. -do(Choice, StreamIn, StreamOut, Module, ModuleState, Hist) :- +do(_, _, _, _, [e|_]) :- !. +do(StreamIn, StreamOut, Module, ModuleState, Hist) :- call(Module, Hist, ModuleDecision, ModuleState, NewModuleState), write(StreamOut, ModuleDecision), flush_output(StreamOut), - loop(StreamIn, StreamOut, Module, NewModuleState, [Choice|Hist]). + loop(StreamIn, StreamOut, Module, NewModuleState, Hist). loop(StreamIn, StreamOut, Module, ModuleState, Hist) :- get_code(StreamIn, ChoiceCode), byte_to_atom(ChoiceCode, Choice), write(Choice), - do(Choice, StreamIn, StreamOut, Module, ModuleState, Hist). + do(StreamIn, StreamOut, Module, ModuleState, [Choice|Hist]). |