21Flip
21Flip
  • Threads: 17
  • Posts: 94
Joined: Dec 22, 2014
December 31st, 2014 at 4:47:17 PM permalink
I am struggling to learn how to make mathematical models of game ideas, and would appreciate any help you can offer in understanding how to do so.

Right now, I am trying to express how many ways a fresh "shoe" of playing cards can equal a specific sum on the first hand.

An example would be using blackjack values - how many ways could the sum of 13 be made from a 3 deck shoe? Well, that means there are 12 A,2,3... etc, so how many of those combos equal 13?

I know what I want to solve FOR, I just don't know how to learn the language/terms that define it. What is the name of these functions?
ThatDonGuy
ThatDonGuy
  • Threads: 123
  • Posts: 6750
Joined: Jun 22, 2011
December 31st, 2014 at 5:00:36 PM permalink
It's hard to say if there's a single term for what you are trying to do - probably "combinatorics". The main function in this case is probably called the "combination" function; it takes two parameters - positive integer N, and integer K where 0 <= K <= N - and returns the number of ways to select K items from N if order does not matter (e.g. if "1, 2, 3" is the same combination as "3, 1, 2"). This is N! / (K! x (N - K)!).

For example, in order to determine the number of ways to make 13 from a 3-deck shoe, you need to count the number of ways to do it with 2 cards (since you can't do it with 1 card), the number of ways with 3 cards, and so on through 12 (you can't do it with 13 cards as there aren't 13 aces in a 3-deck shoe).

The number of ways to do it with 12 cards is relatively easy to determine; the only way is with 11 Aces and a 2. There are "12 choose 11" (i.e. the number of ways of choosing 11 items from 12 if order doesn't matter) ways of choosing the 11 Aces, and "12 choose 1" ways of choosing the one 2. Both of those values are 12, so the number of 12-card 13s is 12 x 12 = 144.

The number of ways to do it with 11 cards is a little harder, as you have to count (9 Aces, 2 2s) and (10 Aces, 1 3).
21Flip
21Flip
  • Threads: 17
  • Posts: 94
Joined: Dec 22, 2014
December 31st, 2014 at 5:35:40 PM permalink
It's more about learning how to express 13 or 52 unique values, or a plurality thereof, and then do things with those values.

I know WHAT I want to do, but I lack the "vocabulary" to express my thoughts mathematically. I would like to learn that "language", but I don't know where to start.

My real-world example is: How many ways to make a 17 from a fresh six deck shoe, using standard blackjack values, except A is equal to one, never 11.

Now, I know I need to express there are 24 As thru 9s, and 96 10s. I also know that I need to examine each of those values as the first "used" value, with the other 311 values as still available. After "using" that first value, I need to check the sum of the value, and see if a) it equals 17, and if not, b) if that sum is greater than 17. If equal or greater, then stop "drawing" values. If the sum is less than 17, use another value from the "pool" of 311, and repeat.

When this process does yield a 17, add +1 to the count of "ways to make 17".

Also, do not repeat any pattern of values done before.

I know WHAT I want, I don't know HOW to express it in terms a computer can understand. I mean, I imagine this is what spreadsheets and programming does, but I don't know WHAT to learn to tell the computer to do it.

It's like seeing/hearing a language, but not knowing if you need to learn French, Russian, Japanese or what to understand them.
beachbumbabs
beachbumbabs
  • Threads: 101
  • Posts: 14268
Joined: May 21, 2013
December 31st, 2014 at 7:14:00 PM permalink
Try these:

apheat.net

apheat.net

apheat.net

Then click on the link in the left margin and order his book on Amazon. Today.

teliot is a member on here (though on sabbatical for now) and very knowledgeable. I HIGHLY recommend his book for what you're doing and what you're asking.
Last edited by: unnamed administrator on Aug 8, 2024
If the House lost every hand, they wouldn't deal the game.
dwheatley
dwheatley
  • Threads: 25
  • Posts: 1246
Joined: Nov 16, 2009
December 31st, 2014 at 8:09:19 PM permalink
Quote: 21Flip

My real-world example is: How many ways to make a 17 from a fresh six deck shoe, using standard blackjack values, except A is equal to one, never 11.

Now, I know I need to express there are 24 As thru 9s, and 96 10s. I also know that I need to examine each of those values as the first "used" value, with the other 311 values as still available. After "using" that first value, I need to check the sum of the value, and see if a) it equals 17, and if not, b) if that sum is greater than 17. If equal or greater, then stop "drawing" values. If the sum is less than 17, use another value from the "pool" of 311, and repeat.

When this process does yield a 17, add +1 to the count of "ways to make 17".

Also, do not repeat any pattern of values done before.



This is a simple and not great way of thinking about this problem, because of the last sentence. You could run a simulation that thinks like you do and get very close to the answer, but it wouldn't be simple to get your simulation to not repeat values.

ThatDonGuy is right, you have wandered into combinatorics. I dare say the most correct way to approach this problem is by counting all the ways the cards can add up to 17 by systematically going through the ways to do it in 2,3,4, etc. cards. Probably could use a generating function.

This isn't just about the language of what you are trying to do, to do this correctly you may need to learn some university-level mathematics that is beyond a lot of people.
Wisdom is the quality that keeps you out of situations where you would otherwise need it
AceTwo
AceTwo
  • Threads: 5
  • Posts: 359
Joined: Mar 13, 2012
January 5th, 2015 at 1:54:36 PM permalink
Quote: 21Flip


Now, I know I need to express there are 24 As thru 9s, and 96 10s. I also know that I need to examine each of those values as the first "used" value, with the other 311 values as still available. After "using" that first value, I need to check the sum of the value, and see if a) it equals 17, and if not, b) if that sum is greater than 17. If equal or greater, then stop "drawing" values. If the sum is less than 17, use another value from the "pool" of 311, and repeat.

When this process does yield a 17, add +1 to the count of "ways to make 17".



No what you describe will NOT give you the correct result.
Say ignoring 10s (which are 96 as opposed to 24 for all the rest)
A Specific 2 card 17 is not the same as a specific 3 card 17.
ie 9,8 is a lot more common than 9,7,1. It has a bigger 'weight' in the calculation.

What you want to do can be done either using a recursive Algorithm if you know Programming OR using excel tables.
Putting A to always equal 1 makes things a lot easier.
But if you want to learn how to do compuations relating to BJ then you do have to take into account the 1 also being equal to 11.

One way to do it in Excel tables is to start from 2 cards.
17 can be made as 10,7 or 9,8.
You calculate the combinations of these 2 (explained in the other thread for 5 cards).
You caluclate the combinations for exceeding 17, ie getting 18,19,20 (that's 10,10 10,9 10,8 9,9)
You calculate the total combinations of 2 cards
You find the probability of 2 card 17, 2 card over 17 and 2 card under 17 (being 1 - the other 2 probabilities)

Then you do the same thing for 3 card 17.
10,6,1 10,5,2 10,4,3 9,7,1 9,6,2 9,5,3 9,4,4 8,8,1 8,7,2 8,6,3 8,5,4 7,7,3 7,6,4 7,5,5 6,6,5
You caluclate the combinations for this
You calculate the total 3 card combinations
Yoy find the 3 card 17 probability
BUT this is a conditional probability it needs to be multiplied by the probaility of 2 card under 17.

And so on and it gets really messy but is doable.
21Flip
21Flip
  • Threads: 17
  • Posts: 94
Joined: Dec 22, 2014
January 8th, 2015 at 6:18:14 PM permalink
Quote: AceTwo

No what you describe will NOT give you the correct result.
Say ignoring 10s (which are 96 as opposed to 24 for all the rest)
A Specific 2 card 17 is not the same as a specific 3 card 17.
ie 9,8 is a lot more common than 9,7,1. It has a bigger 'weight' in the calculation.




What I am trying to do is find out the number of combinations that make 17, individually for each combination of cards...

So, all the ways to make a 2 card 17, all the ways to make a 3 card 17, all the ways to make 4 card 17, so on....
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
January 9th, 2015 at 11:45:22 AM permalink
Quote: 21Flip

What I am trying to do is find out the number of combinations that make 17, individually for each combination of cards...



Why don't you just list them ? Play every possible card combination until you stand or bust, and put every hand in a correspnding bin labeled "2 card 17", "3 card 19".
Save the result, and be done with it.

Or do you try to find such an algebraic formula in the form of "x-card y" ? If so, why ?
  • Jump to: