One simple way would be something like this:
For each processor:
1. myID = Some unique ID
2. myLeader = myID
3. Loop forever:
3.1 For each neighbour:
3.1.1 Read (id_i, leader_i)
3.1.2 If leader_i > myLeader
188.8.131.52 myLeader = leader_i
3.2 Write to all neighbours: (myID, myLeader)
The idea is that you use some property (Say IP address, MAC address, anything that is serialised by the manufacturer), and chose the maximum number as the leader.
Of course you can bound the number of iterations by
a + b + 1 (if you have a synchronized way to make each one work on it's turn) since this is the maximum "jumps" an ID has to make is from one corner to the corner on the other side of the board.
This algorithm is also self-stabilizing which is a good property to have. There are also versions of this algorithm where there is not unique identifier, there you let each processor chose a number at random, and then do the same, while making sure no two processors have selected the same random number (and if so, have some tie breaking).
* Self-stabilization is good if you consider a senario where nodes maybe turned off at any time, and get turned back on after any amount of down time.