Iterating over a list in pseudo-random order without storing a shuffled list

前端 未结 5 593
失恋的感觉
失恋的感觉 2021-01-02 08:10

In a game, we use a technique called \'colour picking\' to select units.

This means that every visible unit is given a unique colour.

Here is an example of a

5条回答
  •  既然无缘
    2021-01-02 08:34

    Can you simply take step_size to be the total available colors divided by the total units, and then use (unit_index * step_size) as the color for each unit?

提交回复
热议问题