关于幻想体育(蛇)选秀的数学问题

时间:2011-02-06 17:54:37

标签: php algorithm math

如果您熟悉任何幻想体育选秀,草案顺序网格看起来像这样:

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_numberpick_number_of_that_round

我无法弄清楚将overall_pick_number转换为正确的pick_number_of_that_round的公式。

在上面的例子中,数字8等于2(第3轮的第2个选择)。但是在一个4人队的联赛中,8号等于4(第2轮的第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)

我考虑过根据联盟中包含每个选秀权的球队数量动态建立一个关联数组,以及它所属的那个选择,但它只是超出我的范围。

2 个答案:

答案 0 :(得分:6)

我会通过 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
}

答案 1 :(得分:5)

round_number         = ((overall-1) / number_of_teams) + 1
pick_number_of_round = ((overall-1) % number_of_teams) + 1