Ai

rewrite of rat AI