I'm a bit rusty with Prolog, but if you still need help then ask. precondition: ae (armEmpty), on(x, table), clear(x).All blocks are the same size, and you can't pick up a block that's underneath another block. The program then works out how to get from the initial state to the goal state. I think he means that game that gets distributed as "Mahjong" even though it's nothing to do with the actual real-world game of that name (except for the appearance of the "tiles").No, he means the blocks world problem: you start with an arbitrary initial state, and have an arbitrary goal state. You can do this by working backwards from the goal state. You then need to find a way of taking a start state and a goal state and applying a set of operators to the initial state to result in the goal state. It's simple to write a predicate that applies an operator to the current state:Īpply(Rule, State, NewState) :- p_op(Rule, Pre, Add, Del), subset(Pre, State), union(State, Add, TState), subtract(Del, TState, NewState). This takes two blocks and stacks them on top of one another, providing that they are both "clear" (it's a simplified world representation, so don't blame me if there's faults in it :-)). These operators have a list of preconditions that must be true of the world before they can be applied, an additions list which adds facts to the world after they have been applied, and a deletion list which deletes facts from the world after they have been applied. If it's the latter, then that is quite easy (I'll show you a simple STRIPS like system):ĭefine some operators. Do you wish to make a game, or do you wish to make a planning system which will take an initial state and a goal state and generate a plan to move the blocks so that they are in the goal state?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |