Say I have a table that goes clockwise like this:
2
1 3
0
This works fine in a 4 person game, but in a 3 person game, the server does not see a 4th chair. Thus, I must map 3 players, one of whom may sit at seat [3] to an array of 3 [2] elements.
So if players were sitting at 2,3,0 then 2 maps to 0, 3 maps to 1 and 0 maps to 2. If the seating was 1, 3, 0 it would map 1 to 0, 3 to 1, and 0 to 2.
What would be a good algorithm to do this if I wanted a std map for this?
Assuming you have an ordered structure of the seats, and making a few assumptions because the details of your implementation are not clear:
Note that this does not match either of your examples; it always gives 0 first precedence, but you can change the for loop as necessary if that is a problem.