Jump to content

Hey all, 

 
I am trying to make a knowledge base for an expert system called Exshell using SWI-Prolog. I have tried posting on their forum but have got no response. when the expert system uses the fallowing
 
rule((A :- B),C1).
 
to call the fallowing in the knowledge base
 
rule((move(St1, Cu1) :- 
    (start(state(St1, St2, St3, St4)),
    switch(state(St1, St2, St3, St4), state(Cu1, Cu2, Cu3, Cu4), [state(St1, St2, St3, St4)]))), 100).


start(state(east_side, east_side, east_side, east_side)).


switch(state(F1, G1, W1, C1), state(F2, G2, W2, C2), History) :-
    is_end(state(F1, G1, W1, C1))
    ;
    move_state(state(F1, G1, W1, C1), state(F2, G2, W2, C2)),
    not(is_history(state(F2, G2, W2, C2), History)),
    switch(state(F2, G2, W2, C2), state(F3, G3, W3, C3), [state(F2, G2, W2, C2)|History]).
 
it returns the fallowing to.
 
A = move(_4238,_4240)
 
Is it not able to see the start predicate? if so, why not and how do I fix it?
 
Thanks in advance!

Travis

Link to comment
https://linustechtips.com/topic/966165-prolog-expert-system-problem/
Share on other sites

Link to post
Share on other sites


[trace] 22 ?- rule((A:-B),C1).
   Call: (8) rule((_2174:-_2176), _2182) ? creep
   Exit: (8) rule((move(_2466, _2468):-start(state(_2466, _2484, _2486, _2488)), switch(state(_2466, _2484, _2486, _2488), state(_2468, _2512, _2514, _2516), [state(_2466, _2484, _2486, _2488)])), 100) ? creep

A = move(_2466, _2468),

B =  (start(state(_2466, _2484, _2486, _2488)), switch(state(_2466, _2484, _2486, _2488), state(_2468, _2512, _2514, _2516), [state(_2466, _2484, _2486, _2488)])),
C1 = 100.

You can view the trace to see what is being unified. Not sure what you're trying to accomplish here, though, so I can't give any further advice. Plus, I don't really remember Prolog too well.
 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×