Similar to Zhihu, how is the matching architecture designed?

each person starts the game with a different Rank (a total of 14 Rank) and selects two people to answer the question pk,. How to design this algorithm?

suppose that after I click to start the game, I send my request to enter a game to the server, and then enter the waiting link. After the server can form a room, it sends a notice to the members of the room. When the number of people who meet the requirements is not enough, when they are unable to form a room, they will wait. Players can"t wait, but quit the waiting session.

requirement:
1. Within one day, the same person will not match twice (to prevent personal cheating)
2. If you match the same Rank first, the same Rank cannot match the next adjacent Rank. Extend
3 in turn, and the highest Rank 14 can only match 14,13,12 players
4. 10 seconds can not match, exit the match, indicating that the match failed

.

different ranks form a queue. Each time two people come in and take out two people, they will fight when the conditions are met. If the queue is empty, it will be fetched from the adjacent queue. The system regularly cleans up the unmatched

.
Menu