Behavior trees for AI: How they work