Modifying a Decision Tree

Assume you have a game where an guard uses the below decision tree to provide some AI that decides how to respond to an enemy.

Decision tree for guard AI

Now, assume you want to make the AI a bit “smarter” by only flanking when there is an ally near (after all, you need more than one person to flank). If an ally is not near, wait until an ally comes near.

  1. Modify the decision tree picture to depict this new “smart flanking” behavior.

  2. Modify the decision tree code to support this new “smart flanking”.

        if visible? { // level 0

           if close? {  // level 1
              attack;

           } else {     // level 1

              if flank? {  // level 2
                 move;
              } else {     // level 2
                 attack;
              }
           } 

        } else {      // level 0

           if audible? { // level 1
             creep;
           }
        }
  1. As an alternative to the above implementation, how might you implement your decision tree so it is easier to maintain?

Hand-in

Have ONE person from each group submit the group’s answers:

https://wpi.qualtrics.com/jfe/form/SV_1IcpULYU2UJQBF4

Make sure to include the names of all group members.

Happy decision-tree-ing!

– Mark