That's an interesting example of how to apply basic math. I've mentioned before that games should start incorporating more simulation and real AI, and for that we need more prepared game people, a profile beyond the typical game programmer.
Maybe game companies will have a resident computational scientist now?
This is why I'm so impressed with what Madoc has done. Especially since he's self taught yet he's doing more advanced programming in regard to physics and AI than in any other game I know of. Not to mention he's also doing the job of 20 people (project lead, programmer, animator, PR, graphics and textures, etc., etc.). I think Aes Sidhe was correct when he named him "The Mad Doc" lol.
Currently his AI will take many things into account; whether you are making eye contact, how well equipped you are vs. how well equipped they are in order to determine if it wise to attack, what actions you've previously done (which the AI has witnessed) helps determine how the AI treats you, whether you have your back turned (attack of opportunity), whether or not you're already engaged in combat (attack of opportunity), whether or not attacking you will help/hinder their overall goals/progress, etc. These are just a few of the things the AI takes into consideration which determines how the AI will react.
And there are many things AI are capable of doing other than just attack or not attack. They may attempt to follow you if they find you suspicious in order to observe what you are doing. They can stalk you if they want to kill you for whatever reason but they're waiting for a good opportunity to do so. They may decide to help you if they determine it is beneficial for them to do so or betray you for the same reason. The AI considers the short term and long term events in order to make a decision or form an opinion.
I could write an entire essay on his AI and another essay on his physics system and procedural animation, and how these both significantly impact gameplay, but this is not the place to do so (besides, the game is still under NDA).