In duplicate bridge, when cards are shuffled and dealt, they are
placed in boards so that different teams can play exactly the same deals,
greatly reducing the role of luck in the game.
The boards and teams move around in an intricate pattern called a movement,
designed in such a way that teams never play the same board twice.
The Mitchell movement is one of the most commonly used movements.
In a Mitchell movement for N tables, there are N North-South teams,
numbered from 1 to N, and N East-West teams, also numbered from 1 to N.
Each North-South team K sits at table K, and does not move for the duration
of the tournament. Each East-West team K starts at table K and moves to the next
higher table at the conclusion of each round, with the East-West team at table N
moving to table 1.
In each round, three boards are played at each table. The boards are numbered from 1 to 3N,
and are initially placed in numerical order, starting at table 1. In other words, boards 1-3 start at
table 1, boards 4-6 start at table 2, and so on. At the conclusion of each round, each board is moved
to the next lower table, with the boards at table 1 being moved to table N.
There is one complication to this simple story. When there are an even number of tables, the East-West
teams would start seeing boards they've already played halfway through the tournament. To prevent this,
a skip is called after each team has played half the boards. When the skip is called, each East-West
teams moves up two tables instead of one table, wrapping around from the high-numbered tables to the low-numbered
tables as necessary. The tournament is then halted when the East-West teams return to their original tables, which
means that each team will have played all but three of the boards. Keep in mind that skips are not called when there
are an odd number of tables.
Given the number of tables N, a round number, and a board number, you must determine
which North-South team and which East-West team play that board in that round. Return the team numbers
in a int[] with two elements, first the North-South team number and then the East-West team number.
Note that the rounds are numbered starting with 1.
|