Hey everyone, pretty new to Prolog and just started programming in it,hence the "newbie"-questions.
I decided to make a small software that, this is basic I know - but I have trouble getting started with it, anyways here's the example;
I'm a carpenter, wanting to build different things for my house so I have a few "recipes" for different stuff and their required ingredients. At home I also have a few ingredients, maybe not enough though.
My ingredients at home;
at_home([ingredient(nails,2), ingredient(wood,10)]).
and the "recipes";
recipe(wooden_roof,[ingredient(nails, 4), ingredient(hammer,1), ingredient(wood, 5)]).
recipe(stairs, [ingredient(nails, 2), ingredient(hammer,1), ingredient(wood, 2)]).
Now I want to be able to write ;
build(X) and then the software should return all the things I can build.
And the second part of the example is that I want a function (I've some programming in C# so I'm a bit damaged from that, lol)
called "buy" where it returns what I need to buy in order to be able to build everything, i.e;
buy(X,L)
And then it returns the ingredients needed to be bought.
Is there anyone who can help me with that? I really need a kick in the butt to get started.
Or do ya have any recommended tutorials?
I decided to make a small software that, this is basic I know - but I have trouble getting started with it, anyways here's the example;
I'm a carpenter, wanting to build different things for my house so I have a few "recipes" for different stuff and their required ingredients. At home I also have a few ingredients, maybe not enough though.
My ingredients at home;
at_home([ingredient(nails,2), ingredient(wood,10)]).
and the "recipes";
recipe(wooden_roof,[ingredient(nails, 4), ingredient(hammer,1), ingredient(wood, 5)]).
recipe(stairs, [ingredient(nails, 2), ingredient(hammer,1), ingredient(wood, 2)]).
Now I want to be able to write ;
build(X) and then the software should return all the things I can build.
And the second part of the example is that I want a function (I've some programming in C# so I'm a bit damaged from that, lol)
called "buy" where it returns what I need to buy in order to be able to build everything, i.e;
buy(X,L)
And then it returns the ingredients needed to be bought.
Is there anyone who can help me with that? I really need a kick in the butt to get started.
Or do ya have any recommended tutorials?