Well,
I'd say don't go and code the AI rules yourself. Let it be evolved from a population
of rules. Find yourself an "alphabet" that is able to code the input-situation and the
field that should be set next (actually this sounds exactly like an cellular automaton).
You might consider using my
Simple Generalized Genetic Algorithm for the optimization
(well, I'd be happy if anyone would use it *grin*)
My experience with AI systems (and GA and G and ...) has been to put as few
human-made rules into the system as possible and evolve a solution...
GoodLuck!