Closed Wokarol closed 5 years ago
It also doesn't produce garbage and isn't expensive
Thanks a lot, those look handy indeed. I'll be able to integrate it in about 10 days
When I was making it I realised that some kind of Random Composite that chooses random node only once would be cool too. But I have no idea how to do it. Right know Selector + Succeeder on each child will do the trick.
I've merged it and added some tests. One thing that's a bit unclear to me right now is what should happen with the child priorities for the stops rules. Right now I kept it the original order (not the randomized one), but one could argue that the children priorities should change to the randomized order...
Added Randomized Selector and Randomized Sequence. Randomized Sequence runs children in random order until one until one fails and fail (succeeds if non of the children fails). Randomized Selector runs children in random order until one succeeds and succeed (succeeds if one of the children succeeds).
Selector is not biased and picks totally random order
While the previous method of using
Random
decorator on each child chooses 1st option more often