Greets all,
I'm trying to design a card counting system for my MUD's blackjack game. The game uses an 8 deck shoe (so 8 decks are shuffled together).
To begin calculating the odds, I need to know all possible combinations of cards to get any sum from 1 to 20. These combinations allow for repetitions and must account for all possible orderings of the cards. Further, the highest number that can be used is 11 (an ace),
So for 4 we have:
4, 3 + 1, 2 + 2, 1 + 3, 2 + 1 + 1, 1 + 2 + 1, 1 + 1 + 2, 1 + 1 + 1 + 1
I've been trying to write a subroutine that outputs all these combinations, but the one I've written isn't parsimonious enough. When you get into higher numbers (around 15) it takes forever (like hours). I'm wondering if anyone has any ideas on a subroutine that would be able to do this without overwhelming the processor. If anyone wishes, I could post my subroutine which kind of works like an odometer. But as I said, it doesn't work well.
The next problem I'm having is that I'd like to store the combinations in a MUSHclient variable (that way MUSHclient doesn't have to figure out all the cominations over and over again). I've been storing them in the form:
4|3 + 1|2 + 2|1 + 3|2 + 1 + 1|1 + 2 + 1|1 + 1 + 2|1 + 1 + 1 + 1|
But when I get into higher numbers (like 14), the amount of text is too large and it gets cut off. To get an idea of how much text is needed, the formula for calculating the combinations for any particular number is 2^(n-1). So for 20 there are close to 524288 combinations (since we can't have any card greater than 11, there's actually a few less than that). Is there a way to store this large amount information in MUSHclient in a manner that will let it be split into an array later on?
I've been working on this one for a couple weeks and am starting to get frustrated. I think if I was a bit more adept at math, I'd be able to figure out some shortcuts to make this less demanding on the processor. But so far no luck.
Any help is GREATLY appreciated.
I'm trying to design a card counting system for my MUD's blackjack game. The game uses an 8 deck shoe (so 8 decks are shuffled together).
To begin calculating the odds, I need to know all possible combinations of cards to get any sum from 1 to 20. These combinations allow for repetitions and must account for all possible orderings of the cards. Further, the highest number that can be used is 11 (an ace),
So for 4 we have:
4, 3 + 1, 2 + 2, 1 + 3, 2 + 1 + 1, 1 + 2 + 1, 1 + 1 + 2, 1 + 1 + 1 + 1
I've been trying to write a subroutine that outputs all these combinations, but the one I've written isn't parsimonious enough. When you get into higher numbers (around 15) it takes forever (like hours). I'm wondering if anyone has any ideas on a subroutine that would be able to do this without overwhelming the processor. If anyone wishes, I could post my subroutine which kind of works like an odometer. But as I said, it doesn't work well.
The next problem I'm having is that I'd like to store the combinations in a MUSHclient variable (that way MUSHclient doesn't have to figure out all the cominations over and over again). I've been storing them in the form:
4|3 + 1|2 + 2|1 + 3|2 + 1 + 1|1 + 2 + 1|1 + 1 + 2|1 + 1 + 1 + 1|
But when I get into higher numbers (like 14), the amount of text is too large and it gets cut off. To get an idea of how much text is needed, the formula for calculating the combinations for any particular number is 2^(n-1). So for 20 there are close to 524288 combinations (since we can't have any card greater than 11, there's actually a few less than that). Is there a way to store this large amount information in MUSHclient in a manner that will let it be split into an array later on?
I've been working on this one for a couple weeks and am starting to get frustrated. I think if I was a bit more adept at math, I'd be able to figure out some shortcuts to make this less demanding on the processor. But so far no luck.
Any help is GREATLY appreciated.