BDI - an algorithm
forever do
update beliefs using sensors
update actions based on current plans
if( a plan, P, has succeeded )
mark relevant goal, G, as achieved
drop the intention to achieve G
elseif( a plan, P, has failed )
if( there is another plan, P2, that might achieve G )
replace P with P2 in the intention to achieve G
else
mark relevant goal, G, as failed
endif
if( there is a new goal, G )
if( there is a plan P that might achieve G )
form an intention to achieve G, using plan P
else mark G as failed
end //forever do