Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

ProLog Program to buy car and truck

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

Program to buy car and truck.......

Code for ProLog Program to buy car and truck in Artificial Intelligence

predicates
   car(symbol,real,integer,symbol,integer)
   truck(symbol,real,integer,symbol,integer)
   can_buy(real)

clauses
   car(chrysler, 130000, 3, red, 12000).
   car(ford, 90000, 4, gray, 25000).
   car(datsun, 8000, 1, red, 30000).
   truck(ford, 80000, 6, blue, 8000).
   truck(datsun, 50000, 5, orange, 20000).
   truck(toyota, 25000, 2, black, 25000).
   
   can_buy(Cost) :- car(M1, C1, _, _, _), C1<=Cost, write(M1), nl.
   can_buy(Cost) :- truck(M2, C2, _, _, _), C2<=Cost, write(M2), nl.
   
  
Share: 


Didn't find what you were looking for? Find more on ProLog Program to buy car and truck Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of ProLog Program to buy car and truck is from India.
 
View All Articles

 

Other Interesting Articles in Artificial Intelligence:


 
Please enter your Comment

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

 
No Comment Found, Be the First to post comment!