use robot as knowledge. module robotEvent { % Update the agent's state of movement. % duration forall percept(state(NewState)), bel(state(State), State \= NewState) do delete(state(State)) + insert(state(NewState)). % Record when we are entering or leaving a room. % act-goTo if bel(in(Place)), not(percept(in(Place))) then delete(in(Place)). if percept(in(Place)), not(bel(in(Place))) then insert(in(Place)). % Update if agent is holding a block % act-pickUp if percept(holding(BlockId)), not(bel(holding(BlockId))) then insert(holding(BlockId)). % Agent is no longer at a block % act-pickUp forall bel(atBlock(BlockId)), not(percept(atBlock(BlockId))) do delete(atBlock(BlockId)). % Agent is at a block % act-goToBlock forall percept(atBlock(NewBlockId)), not(bel(atBlock(NewBlockId))) do insert(atBlock(NewBlockId)). % Completed sequence % act-putDown if percept(sequenceIndex(1)), bel(holding(BlockId), color(BlockId, Color, Room)) then delete(holding(BlockId)) + delete(color(BlockId, Color, Room)) + insert(collect(Color)). }