I want to write a program that simulates the following: I have 6 dice, and I roll with some dice every time.
When I don’t roll with a die, I just assume that I rolled 0 with that.
I want to list all the possible variations I can get this way. A few examples:
1,2,4,6,0,1
3,5,1,0,0,4
6,6,4,2,0,0
etc.
Any ideas on how to do this?
(I am using Java, but of course, I’m only interested in the general concept.)
You can use a recursive method, keeping track of depth:
EDIT, maybe this method would be better: