I am trying to figure how how to find all the combinations given the following information:
I start with a JSON dataset:
var choices = { 1: {'Q': 100, 'R': 150, 'W' : 250, 'T', 30},
2: {'Q': 90, 'R': 130, 'W' : 225, 'T', 28},
3: {'Q': 80, 'R': 110, 'W' : 210, 'T', 25},
4: {'Q': 70, 'R': 90, 'W' : 180, 'T', 22},
5: {'Q': 60, 'R': 70, 'W' : 150, 'T', 18},
6: {'Q': 50, 'R': 50, 'W' : 110, 'T', 15},
7: {'Q': 40, 'R': 30, 'W' : 80, 'T', 11},
8: {'Q': 30, 'R': 25, 'W' : 50, 'T', 8},
9: {'Q': 20, 'R': 10, 'W' : 25, 'T', 5},
10: {'Q': 10, 'R': 5, 'W' : 15, 'T', 3}
};
What I'm trying to figure out is how I can take this dataset, and generate all possible combinations when selecting either the 'Q', 'R', 'W', or 'T' element for each row.
So I hope my end result will be something like this
var allChoices = { 0: {1: {'Q': 100},
2: {'R': 130},
3: {'W' : 210},
4: {'W' : 180},
5: {'T', 18},
6: {'R': 50,},
7: {'Q': 40,},
8: {'T', 8},
9: {'R': 10},
10: {'W' : 15},
},
1: {...},
...
1048576: {...}
};
I used JSON because I think it is the easiest to visualize but does anyone know how I could go about accomplishing this in c#?
Let me know if this not clear enough I'm having a hard time figuring out how exactly to ask this question.