You cant make an AI that thinks for itself, but you can code something really close

You'd have to nest hundreds and hundreds of if/then/elseif/else/endif-s to make a flawless AI.
An AI that 'thinks for itself' takes different stances depending on it's current situation/
This kind of AI would need to continuously store data every second in order to decide what to do next.
Most AIs just do a completely different thing every second
AIs require you to order your if/then/endif statements by priority.
The AI in DotA unfortunately lacks this and I have an exploit for that:
- If you're about to die, make sure there's a low HP enemy creep nearby because then
you can trick the AI into denying the creep instead of killing the hero.
This is the cause of the problem:
JASS:
// ...
if (there's a creep nearby with low hp) then
// attack him
elseif (there's an enemy hero nearby with low hp) then
// attack him
elseif // ....
endif
That way, anytime there's a nearby low hp creep on the enemy's side, it would deny it even if the AI hero is about to kill you
This is why "priority" is very important when writing AI scripts
