Using the "Beagle" arrangement, if the team is even in the number of teams in half (the team to the singular, the last to "0" to form an even number), the first half from the beginning of 1th, written down on the left, the last half of the number from the bottom to the right, and then use the horizontal line to connect the relative numbers. This is the first round of the game. The second round moves the number in the top right corner of the first round ("0" or the largest number of symbols) to the left corner, and the third wheel moves to the right corner, and so on. That is, the singular round when "0" or the largest one is in the upper-right corner, the even-numbered rounds in the upper left corner. Shown below: 7 team match arrangement method first round second round third round fourth round fifth round sixth round seventh round 1-0 0-5 2-0 0-6 3-0 0-7 4-02-7 6-4 3-1 7-5 4-2 1-6 5- 33-6 7-3 4-7 1-4 5-1 2-5 6-24-5 1-2 5-6 2-3 6-7 3-4 7-1 Whether the team is singular or even, the last round must be "0" or the largest one in the upper right corner, "1" in the lower right corner. Depending on the number of teams, "1" moves in a counterclockwise direction in a position, should be moved in accordance with the specified number of intervals (see table), "0" or the maximum code number should precede the "1" moving position. C # implementations:
protected void Page_Load (object sender, EventArgs e) {list<int[]> List = new list<int[]> (); List<int> teams = new List<int> {1, 2, 3, 4, 5, 6, 7}; Int[] Array = teams. ToArray (); Number of teams int initlen = array. Length; Tournament rounds int turns = initlen-1; If it is odd, use 0 empty if (Convert.toboolean (initlen% 2)) {teams. ADD (0); turns = Initlen; } list. ADD (teams. ToArray ()); int max = Teams[teams. COUNT-1]; The number of intervals, calculated as (n-4)/2+1 int steps = Initlen <= 4? 1: (initlen-4)/2 + 1; List<int> parselist = teams; int temp = 0; for (int n = 0; n < turns; n++) {//Remove empty bool Ismax = parselist[0] = = max? true:false; Parselist.removeat (parselist[0] = = Max 0:parselist.count-1); int[] Temparray = Parselist.toarray (); int templen = Temparray.length; int templen = Ismax? Steps + 2:steps; for (int i = 0; i < Templen; i++) { Right Displacement temp = temparray[templen-1]; for (int j = templen-2; J >= 0; j--) {temparray[j + 1] = Temparray[j]; } temparray[0] = temp; }//Fill vacancy string tempstring = Ismax? String. Format ("{0},{1}", String. Join (",", Temparray), max): string. Format ("{0},{1}", Max, String. Join (",", Temparray)); int[] Parsearray = array.convertall<string, int> (Tempstring.split (', '), s = = Int. Parse (s)); Parselist = new list<int> (Parsearray); List. ADD (Parsearray); }//squad for (int i = 0; i < list. Count; i++) {Response.Write (string. Format ("---------{0} round--------<br/>", i)); int[] ar = list[i]; int length = ar. LENGTH/2; Int[] left = new Int[length], right = new int[length]; list<int> lll = new list<int> (); for (int j = 0; J < length; J + +) {Left[j] = ar[j]; RIGHT[J] = ar[j + length]; } array.reverse (right); for (int j = 0, J < left. Length; J + +) {Response.Write (string. Format ("{0},{1}<br/>", Left[j], right[j])); } }}
Results:
---------the No. 0 round--------
1,0
2,7
3,6
4,5
---------the 1th round--------
0,5
6,4
7,3
The
---------the 2nd round--------
2,0
3,1
4,7
5,6
---------the 3rd round--------
0,6
7,5
1,4
2,3
---------the 4th round--------
3,0
4,2
5,1
6,7
---------The 5th round--------
0,7
1,6
2,5
3,4
---------the 6th round--------
4,0
5,3
6,2
7,1
---------the 7th round--------
0,1
2,7
3,6
4,5
C # "Beagle" layout method