started AI for 2d

It should be working fully now for 2d, although the logic is fairly
limited.