Basically how the logic works is it goes through all the Actions, for each Action it goes through all valid grid positions and calculates a certain ActionValue for taking that Action on that GridPosition
Then the AI simply selects the Action + GridPosition that has the highest ActionValue and takes that action.
As to specifically how it decides where to move, in the course I decided to base that ActionValue on testing how many Units are Shootable from that GridPosition.
For example, if you have a GridPosition where there are no Shootable targets, and another GridPosition where there is one Shootable target, the AI will go to the second Grid Position since the ActionValue is based on the number of Shootable targets.