Jump to content
  • Advertisement
Sign in to follow this  

Bookmarking A Combination Algorithm?

This topic is 4581 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a method that calculates C(n, r) for an array of indices. No big deal. The problem is that I want to run this calculation asynchronously, because the size of possible combinations is too large a) to wait for, and b) to initialize an array to store it. For example if you were building a poker odds calculator, you'd notice that to find all combinations of you, and an unknown player showing down to the river, you'd have this on your hands: 1. C(52, 2) : deal your hand, which is known; this is for reference only. 2. C(50, 2) * C(48, 5) : deal your unknown opponent, then the board cards. ------------------- 1225 * 1712304 = 2097572400 combinations Obviously you can't work with that kind of size with a single synchronous call to a combination method. My question is whether the concept of factoradics (in short, serializing a combination to a unique int) could be applied here to give that method, or a derived method, a "bookmark" to get back to the combination task at hand, which would allow it to process, say, one million combinations at a time, but know where it left off and still be able to access each combination in case we're not dealing with int arrays but references to objects -- I know we can't keep them around but can we reconstruct them dynamically from a factoradic index? I guess I'm looking for some help visualizing what this would look like, and how one could manage the combination method to be able to process example 2. (two combinations that depend on each other, i.e. a foreach in C#) so that it could be run asynchronously.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!