So I'm working on a project where I have (the equivalent of) 15 boolean variables, with associated "costs" and other attributes.
I want to iterate through every permutation of these 15 boolean variables (e.g. all 0s, all 1s, etc.) so I can perform further analysis.
My result will presumably be an array with all 2^15 = 32k permutations (which is fine). Having each element be a string is probably fine.
I've tried searching for solutions (like this: Permutations in JavaScript?), but those aren't exactly what I'm looking for.
Greatly prefer a JavaScript solution, although I know using something like itertools
in Python could perform something similar. As I originally tried to hack something together, I was trying to think of a recursive solution (beats having 15 for-loops), but I could use a bit of help.
Thanks a bunch!