add basic AI but doesn't work

Minor correction and add AI script.