design and implement an aoe algotihm, outputing the aoe grid