All of you guys in the game world must be happy with the new game that just came out this yearCloud topIt’s not strange that Xiao Li seldom plays in the League of heroes after graduation, and the appearance of Yunding Yi has dug a hole for me. With the coming of the new season, the lineup is more diversified. There are 12 professions and 12 elements in total, and some heroes’ professions and elements can be changed by using the equipment golden shovel.
In addition to the gifted Lee of the game, there must be an urgent need for the Genting elite assistant, especially the lovely and beautiful girl who likes playing chess. I happened to find such an interesting script in the treasure trove of human essence.genetic algorithmCan automatically recommend the relatively good lineup of cloud top game.
According to the element grid provided by the current game, we can choose the corresponding core heroes, such asYunxiao gridWe can choose torriac’s fierce swordsman,Hellfire caseWe can choose sexy Olaf and cut people online~
Of course, some players are fond of some heroes. We can also input the corresponding heroes, and the program automatically calculates the better lineup according to the selected heroes, so as to provide some reference for the cloud top game.
Let’s take a brief look at the specific ideas of this script.
The first thing is always to get data. After all, it’s hard for a Qiao Fu to cook without rice. On the official website of the hero league or the website where we play more games, we can use the web crawler to download the hero’s details, element professional expenses and so on to the local.
The design of the genetic algorithm also follows certain assumptions, for example, when calculating the score, it does not take into account the imbalance of various fetters, and the default fetters with more population are more powerful. For example, some fetters are made up of six heroes, but their actual effect may not be as good as the fetters made up of three heroes.
Let’s talk about the genetic algorithm again. The figure below clearly shows the whole process of the genetic algorithm.
In the first step of the coding process, the script uses real coding, and the individual fitness in the population is the score calculation function we take. The overall selection strategy is to copy the individual with the highest score directly to the next generation, and reset the individual with the highest score directly.
Because the code is too long, we don’t show too much here. If you need a little assistant, you can reply “cloud top” in the background.
Let’s take eight people as the ultimate goal of the lineup. Let’s run the assistant to see how it works. Input my favorite Yasuo and rob these two middle way heroes,
Chicken eating assistant, arrange it!