use robot as knowledge. use robotActions. exit=nogoals. module robotMain { % put block down if holding a block and in drop zone if bel(not(state(traveling)), holding(_), in('DropZone')) then putDown. % go to drop zone if holding a block % act-goTo (drop zone) if bel(not(state(traveling)), holding(_), not(in('DropZone'))) then goTo('DropZone'). % pick up block if we are within range and if it has the right color if goal(collect(Color)), bel(not(state(traveling)), not(holding(_)), color(BlockId, Color, _), atBlock(BlockId)) then pickUp(BlockId). % go to block if it has the right color, but we are not next to it if goal(collect(Color)), bel(not(state(traveling)), not(holding(_)), in(RoomId), color(BlockId, Color, RoomId), not(atBlock(BlockId))), not(bel(color(BlockIdx, Color, RoomId), BlockIdx \= BlockId, atBlock(BlockIdx))) then goToBlock(BlockId). % go to the room with the block % act-goTo (room) if goal(collect(Color)), bel(not(state(traveling)), not(holding(_)), color(_, Color, Place)), not(bel(in(RoomId), color(_, Color, RoomId))) then goTo(Place). }