• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Permutation

Status
Not open for further replies.
Level 7
Joined
Jan 7, 2016
Messages
21
Hello all,

Fairly new to making triggers work smoothly. Right now I'm working on a map that basically forces the AI the play the entirety of the game while users make some micro transactions. But what I really need help with is making Permutations.

I am stuck in my own logic of making a loop that is, by my reasoning, infinitely long.

The permutation will be used in addressing which color a certain unit is assigned. 1-4/8 different colors

Any help on the subject would be appreciated.
 
Level 29
Joined
Sep 26, 2009
Messages
2,595
  • Set n = 6
  • Set result = n
  • For each (Integer loop_var) from 1 to (n - 1), do (Actions)
    • Loop - Actions
      • Set result = (result x loop_var)
  • -- use the result of the permutation here
all variables are integers. 'n' is the number you want to permute, result obviously has the result in it.
 
Status
Not open for further replies.
Top