Piece movement depending on second piece

There are spaces n-spaces where n-pieces can go to randomly.
then there is x-space where n-pieces get sent to if they are in the same place as an x-piece.

On a turn x-piece is sent to a random n-space, then an n-piece is sent to a random n-space.
If n-piece is on the same place as x-piece it gets sent to x-location.

How do I code that so that it is performed automatically?

I think I can help with that.

DrNostromo is helping me out with Chess War and I have it (or something very similar) working in the next version to be released as soon as he tells me if and how he wants to be credited.

Hopefully this weekend sometime but I am not rushing him.

In the meantime, if you want to find me in the IRC channel, I may be able to help sooner.