Implemented standard AI script (more advanced than sample AI script)