AI Code Mark II

Everything initially intended is complete.

Smart turning will be next.