所以我玩新英雄。我渴望制作一个统计程序,显示 5 名英雄和另外 5 名英雄的哪支队伍获胜最多。鉴于有 85 个英雄,游戏是 85 选 5 对 80 选 5,这是很多组合。
本质上,我将获取游戏服务器允许我获取的统计数据,然后将 1 放入一个数组中,当英雄获胜时,该数组中有英雄 [1,2,3,4,5][6,7,8 ,9,10][W:1][L:0] 所以在我从历史游戏数据中解析构建数组后,我可以放入我想看到的5个英雄,然后我可以取回所有相关的游戏数据告诉我哪 5 个英雄阵容赢/输最多。
我需要帮助开始的是一个简单的算法来写出我的数组。这是我需要的类似输出:(我已将其简化为 1-10,我得到的代码可以将 10 更改为 x 来表示有多少英雄)。
[1,2,3,4,5][6,7,8,9,10]
[1,2,3,4,6][5,7,8,9,10]
[1,2,3,4,7][5,6,8,9,10]
[1,2,3,4,8][5,6,7,9,10]
[1,2,3,4,9][5,6,7,8,10]
[1,2,3,4,10][5,6,7,8,9]
[1,2,3,5,6][4,7,8,9,10]
[1,2,3,5,7][4,6,8,9,10]
[1,2,3,5,8][4,6,7,9,10]
[1,2,3,5,9][4,6,7,8,10]
[1,2,3,5,10][4,6,7,8,9]
[1,2,3,6,7][4,5,8,9,10]
[1,2,3,6,8][4,5,7,9,10]
[1,2,3,6,9][4,5,7,8,10]
[1,2,3,6,10][4,5,7,8,9]
[1,2,3,7,8][4,5,6,9,10]
[1,2,3,7,9][4,5,6,8,10]
[1,2,3,7,10][4,5,6,8,9]
[1,2,3,8,9][4,5,6,7,10]
[1,2,3,8,10][4,5,6,7,9]
[1,2,3,9,10][4,5,6,7,8]
[1,2,4,5,6][3,7,8,9,10]
[1,2,4,5,7][3,6,8,9,10]
[1,2,4,5,8][3,6,7,9,10]
[1,2,4,5,9][3,6,7,8,10]
[1,2,4,5,10][3,6,7,8,9]
[1,2,4,6,7][3,5,8,9,10]
[1,2,4,6,8]...
[1,2,4,6,9]
[1,2,4,6,10]
[1,2,4,7,8]
[1,2,4,7,9]
[1,2,4,7,10]
[1,2,4,8,9]
[1,2,4,8,10]
[1,2,4,9,10]
...
你明白了。没有重复和顺序无关紧要。它基本上减半也与数组的顺序无关。只需要一个可以互相对抗的所有团队组合的列表。
编辑:额外的想法......
经过一番思考。我想出了一些想法。而不是写出 [85*84*83*82*81][80*79*78*77*76*75] 可能的字符组合的整个数组,为了引入新的字符,这些组合必须更大英雄,以保持数组的相关性并不断更新。
相反,当从服务器读取时解析信息并从那里构建数组。当找不到一个元素时,只在数组中创建一个元素会简单得多,因为以前从未播放过这些组合。然后解析数据将是 1 遍,并在符合要求的情况下构建您的数组。是的,这可能需要一段时间,但所创造的价值值得等待。它也可以随着时间的推移而完成。从一个小测试用例开始,比如 1000 场比赛,然后计算出比赛的数量。另一个想法是从我们当前的时间点开始,并从那里建立数据库。没有必要根据英雄在那个时间范围内发生的变化量回到曾经玩过的第一场比赛,但是说回去 2-3 个月给它一些数据的基础和可靠性,
解析和构建数组的示例:
get match(x)
if length < 15/25, x++; //determine what length matches we want and discredit shorter than 15 for sure.
if players != 10, x++; //skip the match because it didn't finish with 10 players.
if map != normal_mm_map // rule out non mm games, and mid wars
if != mm, rule out custom games
//and so forth
match_psr = match(x).get(average_psr);
match_winner = match(x).get(winner);
//Hero ids of winners
Wh1 = match.(x).get(winner.player1(hero_id)))
Wh2 = match.(x).get(winner.player2(hero_id)))
Wh3 = match.(x).get(winner.player3(hero_id)))
Wh4 = match.(x).get(winner.player4(hero_id)))
Wh5 = match.(x).get(winner.player5(hero_id)))
//hero ids of losers
Lh1 = match.(x).get(loser.player1(hero_id)))
Lh2 = match.(x).get(loser.player2(hero_id)))
Lh3 = match.(x).get(loser.player3(hero_id)))
Lh4 = match.(x).get(loser.player4(hero_id)))
Lh5 = match.(x).get(loser.player5(hero_id)))
//some sort of sorting algorithim to put the Wh1-5 in order of hero id from smallest to largest
//some sort of sorting algorithim to put the Lh1-5 in order of hero id from smallest to largest
if(array([Wh1, Wh2, Wh3, Wh4, Wh5],[Lh1,Lh2,Lh3,Lh4,Lh5],[],[],[],[],[],[],[],[],[]) != null)
array([Wh1, Wh2, Wh3, Wh4, Wh5],[Lh1,Lh2,Lh3,Lh4,Lh5],[],[],[],[],[],[],[],[],[]) += array([],[],[1],[][][][](something with psr)[][][[])
else(array.add_element([Wh1, Wh2, Wh3, Wh4, Wh5],[Lh1,Lh2,Lh3,Lh4,Lh5],[1],[][][][](something with psr)[][][[])
有什么想法吗?