Replace loops

Now the external loop runs over the enemy's pieces and the internal runs
over our pieces.

No functional changes.