AI XML parser game

Аватар автора
Алгоритмическая Жемчужина
Task is to develop a program that reads in a behavior tree from an XML data file, build an in-memory representation of this behavior tree, and then provide a method by which the user can input an event to which the program will respond with the appropriate/correct response. You can assume that all leaf nodes within the tree are the responses and all non -leaf nodes are keyed to events. It is possible for an event to have sub -trees. As an example, in the tree below (taken from GDC 2010 talk by Champandard, Dawe, and Hernandez-Cerpa), ‘evade’ is the only valid response to the ‘incoming projectile’ event; ‘use computer’ and ‘patrol’ are both valid responses to the input ‘idle;’ and there are five valid responses (‘flee,’ ‘attack,’ ‘weapon 1,’ ‘weapon 2,’ and ‘weapon 3’) to the input event ‘combat.’ For the input ‘melee,’ ‘flee’ and ‘attack’ are valid responses. root node behavior="Idle" response="" node behavior="" response="Use Computer"/ node behavior="" response="Patrol"/ /node node behavior="Incoming Projectile" response="" node behavior="" response="Evade"/ /node node behavior="Combat" response="" node behavior="Melee" response="" node behavior="" response="Flee"/ node behavior="" response="Attack"/ /node node behavior="Ranged" response="" node behavior="" response="Weapon 1"/ node behavior="" response="Weapon 2"/ node behavior="" response="Weapon 3"/ /node /node /root

0/0


0/0

0/0

0/0