in reply to Looking for combinatorics with state
This sounds a bit like an XY Problem.
Maybe if you were more specific about what you are trying to do, or if you post some code which shows your attempts, we would be able to help you.
Best,
Jim