如果你熟悉任何梦幻体育选秀,选秀顺序网格看起来像这样:
EXAMPLE 1 (3-teams):
Round Team 1 Team 2 Team 3
1 1 (1.1) 2 (1.2) 3 (1.3)
2 6 (2.3) 5 (2.2) 4 (2.1)
3 7 (3.1) 8 (3.2) 9 (3.3)数字1-9代表草案的overall pick number。
括号中的项表示round_number和pick_number_of_that_round。
我找不到一个公式来将我的overall_pick_number转换成它正确的pick_number_of_that_round。
在上面的例子中,数字8等于2(第三轮的第二个选择)。但在四支球队的联赛中,数字8等于4(第二轮的第四顺位)。
EXAMPLE 2 (4-teams):
Round Team 1 Team 2 Team 3 Team 4
1 1 (1.1) 2 (1.2) 3 (1.3) 4 (1.4)
2 8 (2.4) 7 (2.3) 6 (2.2) 5 (2.1)
3 9 (3.1) 10 (3.2) 11 (3.3) 12 (3.4)我想过尝试基于联盟中包含每个选秀权的球队数量以及它属于哪个选秀权来动态构建一个关联数组,但这超出了我的能力范围。
发布于 2011-02-07 02:02:01
round_number = ((overall-1) / number_of_teams) + 1
pick_number_of_round = ((overall-1) % number_of_teams) + 1发布于 2011-02-07 02:14:54
我会修改missingno的答案,让它像蛇一样扭曲。
round_number = ((overall_pick_number - 1) / number_of_teams) + 1
pick_number_of_round = ((overall_pick_number - 1) % number_of_teams) + 1
if (round_number % 2 == 0) {
pick_number_of_round = number_of_teams - pick_number_of_round + 1
}https://stackoverflow.com/questions/4915046
复制相似问题