Question

I'm developing a poker game for iPhone/iPad which uses Apple's matchmaking service. I'll be using a client-server topology where the dealer is the server. With each hand there will be a new server/dealer. However, before the initial dealer/server selection, the game uses peer-to-peer topology, which leaves me with my dilemma.

How do I get all the players/peers to agree on one random peer to be the initial dealer/server, quickly and efficiently?

I'm currently troubleshooting my own method by which I have each peer broadcast a random number. After all numbers have been received, they are sorted and the peer with the lowest number is the initial dealer. However, the issues I'm having with (duplicate numbers, etc) have prompted me to find a better solution.

Any help would be greatly appreciated.

Was it helpful?

Solution

You need to learn about the Paxos algorithm (i.e., election of a leader).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top