Commit b934030c authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain

Francois-style pattern, fails unit-tests with _ => a + b

parent a664de27
......@@ -163,23 +163,31 @@ find_and_add_rule :-
print_message(informational, trying(R)),
add_reaction_backtracking(R).
% TODO use a pattern instead of fixing S =[E]=> P
find_rule(R) :-
enumerate_all_molecules(Molecules),
AllMolecules = ['_' | Molecules],
member(S, AllMolecules),
member(P, AllMolecules),
member(E, AllMolecules),
S \= P,
member(M1, AllMolecules),
member(M2, AllMolecules),
(
E \= '_'
M1 \= '_'
->
S \= E,
P \= E,
R = '=>'(S = [E], P)
M1 @< M2
;
R = '=>'(S, P)
M1 @=< M2
),
member(M3, AllMolecules),
member(M4, AllMolecules),
memberchk('_', [M1, M2, M3, M4]),
(
M3 \= '_'
->
M3 @< M4
;
M3 @=< M4
),
(M1, M2) \= (M3, M4),
write(find_rule(M1, M2, M3, M4)),nl,
reaction_editor:simplify_reaction('=>'(M1 + M2, M3 + M4), R),
\+ item([kind: reaction, item: R]).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment