XML trace output and other tracing enhancements.
Fix naive AI choice tree.