Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

Prolog problem of murder mystory

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 6927

The problem of murder mystory.
Five persons Alice,her husband,brother,son and daughter

Event: One murder.One of the five is victim and one is
Killer.
Rules:
1) Husnband and alice was not together on the night of murder
2) The killer and victim were on the beach.
3) on the night of murder,one male and one female
ware in the bar.
4) The victim was twin and the counterpart was
innocent.
5) The killer was younger than the victim.
6) One child was alone at home.

Code for Prolog problem of murder mystory in Artificial Intelligence

predicates
%    pair(symbol,symbol)
     iskiller(symbol,symbol)
    male(symbol)
    female(symbol)
    isvictim(symbol)
    not_at_bar(symbol,symbol)
    not_at_beach(symbol,symbol)
    not_alone(symbol)
    twin(symbol,symbol)
    younger(symbol,symbol)
    child(symbol)
    
clauses    
    male(husband).
    male(brother).
    male(son).
    
    female(alice).
    female(daughter).
    
    twin(brother,alice).
    twin(son,daughter).
    
    child(son).
    child(daughter).
    
    not_alone(
    not_alone(alice).
    not_alone(brother).
    not_alone(X):-
        
        
    child(X),child(Y)
        
    
    not_at_beach(husband,alice).
    not_at_beach(son,daughter).
    
    not_at_bar(son,daughter).
    not_at_bar(husband,alice).
    not_at_bar(X,Y):-
        male(X),male(Y).
    not_at_bar(X,Y):-
        female(X),female(Y).
    
    
    isvictim(X):-
        twin(X,Y),not(iskiller(Y,X)).
    isvictim(X):-
        twin(Y,X),not(iskiller(Y,X)).
                
        
    younger(son,alice).
    younger(son,husband).
    younger(daughter,alice).
    younger(daughter,husband).

    iskiller(X,Y):-
        not(alone(X)),
        younger(X,Y),
        not(not_at_beach(X,Y)),
        not(not_at_bar(X,Y)).
  
Share: 


Didn't find what you were looking for? Find more on Prolog problem of murder mystory Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of Prolog problem of murder mystory is from India.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Adnan Abushahad from Iraq Comment on: Jan 30
I thinks there are some errors in the code .. I'll analyze it and run it then i'll be back for discussion.

View All Comments