public void count() { if (players % 2 != 0) { return; } int n = players / 2; RoundPair[,] tour = new RoundPair[players - 1, n]; for (int i = 0; i < players - 1; i++) { for (int j = 0; j < n; j++) { tour[i, j] = new RoundPair(); } } for (int i = 0; i < players - 1; ++i) { tour[i, 0].first = 1; tour[i, 0].second = players - i; } for (int j = 1; j < players / 2; ++j) { for (int i = 0; i < players - 1; ++i) { tour[i, j].first = RoundPair.getFirst(i, j, players); tour[i, j].second = RoundPair.getSecond(i, j, players); } } string tempstr = ""; int tour_n = 0; bool swap = true; for (int i = players - 2; i >= 0; i--) { tour_n++; if ((i - 1) % 3 == 0) { swap = !swap; } for (int j = 0; j < players / 2; ++j) { ++flags[tour[i, j].first]; if (swap) { int tmp = tour[i, j].first; tour[i, j].first = tour[i, j].second; tour[i, j].second = tmp; } if (flags[tour[i, j].first] == 6) { flags[tour[i, j].first] = 0; } tvlData.games.Add(new game(tvlData.players[tour[i, j].first - 1].id, tvlData.players[tour[i, j].second - 1].id, r: tour_n)); tempstr += tvlData.players[tour[i, j].first - 1].id + ":" + tvlData.players[tour[i, j].second - 1].id + " "; } if (tour_n < 10) { tempstr = " " + tour_n + " тур: " + tempstr; } else { tempstr = tour_n + " тур: " + tempstr; } tvlData.counted.Add(tempstr); tempstr = ""; } }
public void Round2_count() { tvlData.players.Sort((a, b) => b.coef[0].CompareTo(a.coef[0]));// sort by adam int[] ind = new int[tvlData.players.Count]; for (int i = 0; i < tvlData.players.Count; i++) { ind[i] = tvlData.players[i].id; } indeces = new int[players]; indeces = get_indeces(ind); int n = players / 2; RoundPair[,] tour = new RoundPair[players - 1, n]; for (int i = 0; i < players - 1; i++) { for (int j = 0; j < n; j++) { tour[i, j] = new RoundPair(); } } for (int i = 0; i < players - 1; ++i) { tour[i, 0].first = 1; tour[i, 0].second = players - i; } for (int j = 1; j < players / 2; ++j) { for (int i = 0; i < players - 1; ++i) { tour[i, j].first = RoundPair.getFirst(i, j, players); tour[i, j].second = RoundPair.getSecond(i, j, players); } } bool swap = true; for (int i = players - 2; i >= 0; i--) { tour_n++; if ((i - 1) % 3 == 0) { swap = !swap; } for (int j = 0; j < players / 2; ++j) { ++flags[tour[i, j].first]; if (swap) { int tmp = tour[i, j].first; tour[i, j].first = tour[i, j].second; tour[i, j].second = tmp; } if (flags[tour[i, j].first] == 6) { flags[tour[i, j].first] = 0; } tvlData.games.Add(new game(indeces[tour[i, j].first - 1], indeces[tour[i, j].second - 1], r: tour_n));//1 tempstr1 += indeces[tour[i, j].first - 1] + ":" + indeces[tour[i, j].second - 1] + " "; tvlData.games.Add(new game(indeces[tour[i, j].first + shift - 1], indeces[tour[i, j].second + shift - 1], r: tour_n));//2 tempstr2 += indeces[tour[i, j].first + shift - 1] + ":" + indeces[tour[i, j].second + shift - 1] + " "; } cat_str(); } last_type = 1; }