Math help needed with "expensive" cards

38 replies [Last post]
X3M
Offline
Joined: 10/28/2013

This is some very hard math. That I can't do this time. (I am to stupid for this, honestly).
So... I need some help.

So sorry if the questions sound like a math test.

***

For a game that I am working on. Players are allowed to have a maximum of only 7 cards in their hand.

When an 8th is about to be drawn. Players are forced to play or discard some cards from their hands.

Only 1 card, is drawn per round, per player. This happens at the end of a round.

A card can only be played, if other cards are sacrificed to gather the costs of that one card. So the real first time that an Event Card can be played, is at the start of round 3.

A card with value 5, needs for example a card of value 4 and 1 to be sacrificed. A card with value 6 may also be sacrificed for this, but any excess sacrifice is lost. There is no mana burn.

The value's:
1x9, 2x8, 3x7, 4x6, 5x5, 6x4, 7x3, 8x2 and 9x1.

A total value of 165.
There are 45 cards in total.
The average value is 3.667 per card.

The game has a maximum of 6 players. If all 6 players have 7 cards. The remaining deck is only 3.
With 4 players, the remaining deck is 17 and the maximum hand can be 11 if we choose to leave 1 card as deck.

To keep things simple, I want 7 cards to remain the maximum.

I am worried that 7 cards per player is not enough for certain cards.
If this is the case. I need to double print the deck for 6 players. Or think of an exception rule.

***

The most expensive card has a value of 9.
Assuming that this card has been drawn and the player plans on using it.

How big is the chance that this card can be played with a hand of 2?
A hand of 3?, 4?, 5?, 6? and 7?

The same for the 2 cards with value 8. From which, one is drawn.

And one of the 3 cards with value 7?

There is no need to look at the value's 6 or less.

***

There is a card with value 7 that is allowed to be played multiple times before returning it to the deck. This automatically means, paying multiple times the value.
How many times can this card be played, given that the player has reached 7 cards?

What if the hand is 8 cards?
9? 10?

***

I will be very grateful.

Cheers,
X3M

Stormyknight1976
Offline
Joined: 04/08/2012

You wrote 1x9 , 2x8 , 3x7 , 4x6 , 5x5 , 6x4 , 7x3 , 8x2 , 9x1.

Your cards will look like this,
1 point each for 9 cards.
2 points for 8 cards.
3 points for 7 cards.
4 points for 6 cards.
5 points for 5 cards.
6 points for 4 cards.
7 points for 3 cards.
8 points for 2 cards.
9 points for 1 card.

If you have 6 players , each player recieves 5 cards and the remaining draw pile is 15. 6x5 = 30. 15 cards left for 45 card deck.

If you have 6 players , each player recieves 7 cards and the remaining draw pile is 3. 6x7 = 42. 3 cards left for 45 card deck.

If you have 6 players, each player recieves 8 cards and the remaining draw pile is over 45 which is 48. 8x6=48.

If you have 6 players, each player recieves 6 cards and the remaining draw pile is 9 cards. 6x6=36. 9 cards left for 45 card deck.

Stormy

X3M
Offline
Joined: 10/28/2013
Stormyknight1976, Sorry. That

Stormyknight1976,

Sorry. That doesn't help me at all. Since it is an obvious fact actually.

What I asked for was the situation:
A deck of 45 cards. A player draws the card with value 9 and wants to use it.

How big is the chance that this player will be able to use this card each round. While drawing 1 card each round?

Knowing that 7 is the maximum hand.
If the range is going to be somewhere at 10% or so at 7 cards. I must reconsider adding more cards for the hand. And thus print the deck twice.
If the range is going to be somewhere at 60% or so. It is ok.

This is how far I got:

Other players draw cards as well. But we don't know which ones. So, with 6 players, we can still pretend, there is only one player.

Round 1:
Player draws the value of 9 card. It cannot be spend.
Round 2:
Player draws any value of 1 to 8 by on of the other cards. No matter what it draws. The value of 9 cannot be spend.
Chances to have the following value's ready for sacrifice:
1: 9/44
2: 8/44
3: 7/44
4: 6/44
5: 5/44
6: 4/44
7: 3/44
8: 2/44

In round 3, the chances differ. Since in round 2, any card could have been drawn. And is removed from the deck. Not only that. But the value's ready for sacrifice will range from 2 to 16. And the chance in order to spend the value 9 card after round 3. It needs a sacrifice of value 9 or higher.

I don't know how to put this in the right math for a fast calculation. I guess I need to take the slow road. If Value 9 is satisfying. I don't even have to consider value 8 or less. :)
Except for that value 7 card that can be used multiple times.

X3M
Offline
Joined: 10/28/2013
See how complicated it gets.

When I pretend, that the second card had a value of 1. There are only 8 cards of these remaining.

Chances are now all multiplied by 9/44 (20,5%):
Drawing a 1 yields a total of 2: 8/43 = 72/1892
Total of 3: 8/43 = 72/1892
4: 7/43 = 63/1892
5: 6/43 = 54/1892
6: 5/43 = 45/1892
7: 4/43 = 36/1892
8: 3/43 = 27/1892
9: 2/43 = 18/1892

I have to do the same for when the second card is a value of 2, 3, 4 etc. all up to 8.

The biggest problem is that I can't put all the results together for the next draw of a card. Since each pile is going to be different. So, no cutting branches.

KiltedNinja
Offline
Joined: 10/14/2013
I think I can help

I think I can help you with this - it sounds like an ideal circumstance to create a simulation of the game. I'll see if I can write some code for you to see if it'll help. Don't despair :)

X3M
Offline
Joined: 10/28/2013
Thank you KiltedNinja. By

Thank you KiltedNinja.

By writing out the problem, it is indeed a simulation worthy problem.

There are 2 simulations to write in total.

But I think it is best to focus on the one that looks at "using" the value 9 card. Before even to look at the value 7 card.

The results should look like this:

Hand of 2:
0% chance of playing the value 9 card.
Hand of 3:
##% chance of playing the value 9 card.

By logical reasoning. Having a hand of 9 actually has almost 100%. And a hand of 10 or more will have 100%.
In a sense. It is possible to discard the low value cards. So it would sound reasonable if the hand of 8 and 9 are calculated as well. Of course, by discarding the lowest value or 2 value's for those hands.

I am going to get to work on the hand of 3. That one is still doable on paper.

X3M
Offline
Joined: 10/28/2013
I think I got the hand of 3 done.

I got the answer for a hand of 3, with the first card being the card of value 9.
Drawing 2 more cards and seeing if you can play them.

It is surprisingly high:
If any one can reconfirm, that would be great.

Now for a hand of 4. Which requires me to make 512 combinations to check -.-
I'll think of something. (raises fist to the screen)

Might as well, only focus on the combinations that don't have enough value.

KiltedNinja
Offline
Joined: 10/14/2013
1 step at a time :)

I'm planning this in my head in a similar way to how I've run my battle simulations for my own game. Pretty sure I can make something that'll help you out.

What I'll do is this:
Create the deck of 45 cards with the possible values.
Create 6 players who can each have their own deck.

For each Round (1 .. n)
For each Player (1 .. 6)

Check if cards can be played;
For each card in hand, get value, total remaining cards, if greater than current card value, card can be played.
*assume player wants to play highest possible card*
Play a card.
Draw a card.

next Player
next Round

***
So this leaves the question, when will a player probably play a card? Should this be "Play as soon as possible", or "try to get a few high value cards in hand before playing"?
It seems like; to play a high value card, the player should store a few cards in their hand for a few turns before playing.
We can revisit "when should a card be played" later.
***

So what we can do with the sim;
At the end of each round, we will have 6 players with a hand of cards. We will know how many cards the player has.
For each card, we will have its value, and a flag to say "can this card be played = Yes/No"

..then..
For each card with value of 9 that exists in the players hands (i.e. 1 player might have a 9, but if you double the deck then 2 players might have 9s) we can show how many of this card can be played per round.
Same with each value 8, 7, 6 etc.

We can make a table (I can't draw tables in text, so this will look messy, hopefully you will see the idea);

Value | Round 1 | Round 2 | Round 3 | ...
1 | % of this card that can be played | % round 2
2
3
..
8
9

Also - how many rounds? And how does the game end?
When there is no draw-pile left, do discarded cards get shuffled into a new draw-pile?

Does this all make sense?
I can then easily modify the sim to say "4 players" or "8 players", or "max hand limit = 10", or whatever else is needed.

X3M
Offline
Joined: 10/28/2013
Brilliant. You are doing it

Brilliant. You are doing it for all players at once.

The cards return to the deck after usage. We don't bother reshuffling. The only question here is, in what order are the used cards returned.

So, planning and counting is permitted. But hard.

Let's pretend the deck is going to be depleted after 7 rounds.
With 2 decks, it will be 15 rounds.

Meanwhile, I got the 4th card calculation almost ready.
I actually found a way. But the 5th card can't be done this way.
When a player wants to play the value 9 card in round 4.
The chance that it can do so is 70,8%.

So with the number of cards:
1: 0%
2: 0%
3: 31,3%
4: 70,8%
5: ??
6: ??
7: ??
8: ??
9: ??
10: 100%

What is not included?
The chance that '9' is actually picked by now. :D
And that is where you come in. So I await your pro-art-gram.

***

Obviously, this is lower with just 2 players.
But with 6, the chance is very real. And with 6 players, the card is also stronger. It effects 5 players (2 team members) I never expected a higher chance in combination with a stronger card.

A fun fact just happened here.
I just talked with a friend. And he suggested that players can know, who this card has during play.
It is when one (the intelligent) player carefully places at most, 7 squads within fighting range.

KiltedNinja
Offline
Joined: 10/14/2013
No reshuffle?

Good that you have some progress already!
I've got the basics of the sim coded now. Need to clarify some new things though;

The deck is shuffled at start of game.
When no cards are left in deck, discard pile is just flipped over and is *not* reshuffled.

Is this correct?

X3M
Offline
Joined: 10/28/2013
That is almost

That is almost correct.
Seeing as how a player spends a card and also sacrifices other cards. There are at least 2 cards going to the discard pile, once a player decides on playing one.

Maybe, you could consider the game ended already when the deck is gone. Because my goal is only knowing the chances of the value 9 card being used by any one asap. Either there are 2, 4 or 6 players.

And my second goal is to know how heavy that value 7 card can be.

Both require a specific card gathering strategy from the player.

KiltedNinja
Offline
Joined: 10/14/2013
Ok

No problem ;)

So when a card is played (and the sacrifice cards are discarded) - does that card also go into the discard pile?
Does it go there straight away, or later? (or ever?)

I'll (hopefully) be able to get something working for you this evening, if not then I will definitely have something for you around the same time tomorrow :)

X3M
Offline
Joined: 10/28/2013
Take your time. I should be

Take your time. I should be happy that at least 1 guy tries to help.

When a card is played. It goes to the discard pile, together with the other cards.

Here you find some examples of the cards.

Though, they are mildly updated on my pc.

If a player has both cards. It can play Feign Death. But has to sacrifice Increase Speed. Both cards are onwards to the discard pile.

Stormyknight1976
Offline
Joined: 04/08/2012
Bows respectively

At least I tried.

In my design thought process on how many rounds per game, I think differently and I don't process percentages during the card game on who gets what. Well, I guess I do but I dont write everything of what your doing.

I would have made it one round for the entire deck as players lay their cards down on what they wouldn't need and then attack and defend.

But it is all good.

Bows once again and leaves the room.

Stormy

X3M
Offline
Joined: 10/28/2013
No problem.

Every game is different.

This deck in particular. Requires players to plan ahead. Or act immediately.

Example:
If there is a card that can beat another card. Then the chance to get that card should not be 100%, before the other card even has a slight chance in being drawn.

Also, the requirements for being able to place a card. It asks for sacrificing other cards.

It is very complicated. But 1 thing is sure. The top tier cards need to be balanced. The entire deck/game stands or falls with this fact.

***

It is proven that the problem is very hard. This post had a list of tables. But those where wrong in several ways. I deleted it.

KiltedNinja
Offline
Joined: 10/14/2013
:D

There's a *slight* chance that I'm overthinking this... however, I think it's worth it.

X3M, I've sent you an email with some info (no figures yet though :/) - I just thought it was easier to read with some formatting.

When all is complete, we can post the results and the sim-program in this thread if anyone finds it interesting/useful :)

X3M
Offline
Joined: 10/28/2013
It certainly is KN

Never expected it to be such an adventure. To find things out.

My crazy cousin has found his "first" fault. So a repost could be in order.

Then again, I logically asked him to remove any discard of 6 and higher. Since with a value of 6 as lowest value. You have already the best combination. Turns out, he did think of this. But we can't figure out the no 100% at the last discard (round 38 and 1 player)

Seems he accidental included 666677 amongst many other, not optimal combinations.

I certainly hope that he got it right this time :D

X3M
Offline
Joined: 10/28/2013
When results come in

Now that he (my cousin) got the '7' card right (the simulation rules). I am starting to have doubts about this card.

Still awaiting the same simulator for this card as if it is '6'.

It is very important for me to know when this card can be played.

With it being '7'. Chances are that it can be played in round 3 or 4 already. But the chance for it to fail completely is 5/6th.

In round 5 and 6. The chance is multiplied again by 5/6th. But knowing that the sacrifice is doubled for this. I don't know.

Chances to fail are multiplied every time by 5/6th. And the highest chance to get to this next level seems to be growing longer and longer.

I am starting to believe that it is best to use the card as sacrifice instead. No choice.

So, I await the results on it being value 6 instead. I have good hopes. And the print is already adjusted. But next time, it isn't the value that is going to be adjusted. But the chance on having an effect instead.

But I don't know yet what to do with that.

Quote:
Roll a die.
Roll 6 and you receive 1 extra Action Point, every round indefinitely.
Repay the value multiple times, and you may play this card multiple times.

And change it into:

Quote:
Roll a die.
Roll 5 or 6 and you receive 1 extra Action Point, every round indefinitely.
Repay the value multiple times, and you may play this card multiple times for a maximum of 3 times.

Or change it into:

Quote:
Roll a die.
Roll 4, 5 or 6 and you receive 1 extra Action Point, every round indefinitely.

KiltedNinja
Offline
Joined: 10/14/2013
Simulation

X3M, I've emailed you a working version of the simulation which will run multiple games - and should (theoretically) give you a better clue how to adjust your game parameters.

Hopefully this will help!

Cheers,
Kn.

X3M
Offline
Joined: 10/28/2013
Thanks. I will look into it,

Thanks. I will look into it, somewhere this evening.

In the meantime. I need to do something about my "lotery" card. It is still that card that I described in my last post.

I realized that players could count a bit to much. So, when one deck ends. The entire graveyard deck is going to be shuffled. Before it is used again.

But that doesn't take away the luck that some players can have with the lotery card.

So I need to take away this luck. When a player gets it a bit to much.

Some partial solutions:

A higher chance on the bonus. But limited to one. I see no other way around it any more. So basicly choice 3 from the last post.

Increased cost when you have played the card before. But some games allow for more AP or less AP. It also depends on the campaign. The value should remain 6 for sacrifice.

But the cost for using the card? I am thinking about several stats.
Starting with 6? And add 6 when a player is +1 AP ahead on the rest?
Or just adding 2 or 3 for the costs?
1 seems a bit to low.

I'll keep pondering.

FrankM
Offline
Joined: 01/27/2017
Lottery

Depending on how many dice are included, you could have the player roll a die and keep it displayed. Each turn with +1AP, the die is turned to show the next lower number (if it showed 1, put the die away and discard the card).

The design decision is: is the +1AP mandatory every round, or can the player choose when to use them?

X3M
Offline
Joined: 10/28/2013
Thanks FrankM

All players have 7 AP per round.
There are cards which change this number for 1 round.
But the problem child is the one which does it permanent.
But using the card with a die on it is also a good idea. This way, it isn't permanent either. Making the AP optional to spend, makes it better.

No stacking over time. Maybe only a tempory stack.

joebergmann
Offline
Joined: 12/29/2016
Possible help?

Maybe look at this site:
http://stattrek.com/online-calculator/hypergeometric.aspx
It gives you odds of cards being drawn based upon different factors...

X3M
Offline
Joined: 10/28/2013
Things where a bit more

Things where a bit more complicated then the link you provided. But it can have its use for future efforts.

Also a big thanks to KiltedNinja for the simulator that he send me. It helps a lot for the first 7 rounds with 6 players.

Clearly, the dreadful lotery card that I needed to look at, needs to be worked on. Lewisher doesn't even know that one of his video's helped me as well. So here it is. Thumbs up.

I am not going to make a new topic for that card. Since it is decided to simplify that bastard to a 1 time dice roll per each usage. 50% chance the card works. And a cumulative activation cost. WiTh cumulative sacrifice for the big picture. But maybe the last part can be left out. In theory, every player will pick the card once every 45 rounds. And with 50 percent chance of it working. It translates to activation every 90 rounds.
In game time, that translates to 15 hours for 2 players. So yeah, no big picture :).

Anydice might have the last word in this. Instead of cumulative costs. Which is clunky. Maybe using multiple dice for one roll. And equal these to the number of ap that the player can spend.

The card gets introduced when players can spend 3 ap per round in the single player campaign. So the minimum dice is going to be 3. So the fail part could be if 3 dice roll a... 6?

This evening I will find out.

Fri
Offline
Joined: 09/06/2017
Sorry, I am a bit late in

Sorry, I am a bit late in responding. I tried to find a solution for your original question about having and being able to play a 9. I did not find a complete solution but wanted to share what I found in case it is helpful.

I found a formula that can be applied to find the probability of a card being in hand so many draws. To paraphrase wikipedia (C(K,k)*C(N-K, n-k))/C(N, n) where N is the number of total Number of cards, K is the total number of that specific card, n is the number of cards that have be drawn. k is the of the specific card that has been drawn and C(n,k) is the the n chose k function otherwise known as the binomial coefficient. You can use this to establish an upper bound of the probability of the card being in hand and able to be played. Here are some relevant links about the formulas including an online implementation:
https://en.wikipedia.org/wiki/Hypergeometric_distribution
https://en.wikipedia.org/wiki/Binomial_coefficient
https://www.geneprof.org/GeneProf/tools/hypergeometric.jsp
The probability of a 9 being in hand after six players have drawn 3 cards is 40%.

I tried another more brute force approach as well using some SQL. If you were to draw three cards from the stack there are 85140 possible combinations of which 1776 have a 9 and the other two cards have a total of 9 or higher. This means by drawing three cards of the top you have 2% chance of having and being able to play a nine. For four cards there are 3575880 possible combinations of which 177660 have a 9 and two of the other cards have a total of 9 or higher. This means by drawing three cards of the top you have 5% chance of having and being able to play a nine. For anything after this the simple code I wrote took to long to run.

Hope this helps.

X3M
Offline
Joined: 10/28/2013
Yes... you are a tiny bit

Yes... you are a tiny bit late. But that doesn't matter. All feedback is welcome. And you have showed some numbers as well that I have seen as well. 1776, I remember that one. And looking back in my papers, there is only one thing that I don't understand.

How come, I have 31,3%? What I forgot to do was to multiply this with 3/45. Which is the chance to have the 9. Which is indeed 2,1%.
Thank you for pointing that out.

Same goes for the 5%. In my case, I had 70,8%. The chance to get the 9 card is 4/45. Wait, I get 6,3%. Where did I go wrong?

I think that your suggestion is the road I need to walk to see the playability of the 9 card. INCLUDING drawing it by random.
If the card is going to be played by any player. For that, KiltedNinja has supplied me with a nice simulator, that includes some "ai" as well.

***

Feedback from my gamegroup. 2 players suggested to have 1 card per team after the game. And that players decide together, in how to spend that card. But I dislike that. Why? I think that the decision of a card or piece should stay with one player. co-op is ok. But if multiple players decide for one piece or card. This brings a higher chance to "unrest" between "co-operative" players.

Am I right? Or is this a matter of opinion?

***

Now, to change my lotery card. I had trouble finding time to even think about the details. The way how I look at it now is to have the card spend only one time. It costs 6 AP. How the card could work?

You roll an equal ammount of dice as the number of AP that you may spend in total by default, each round.

This means that you may roll 7 dice for most games. There are games that start with only 1 AP per round, but the card is introduced at 3 AP. Then all cards are introduced actually. Main reason is the Assault/Retreat card. Normally this tactic costs 3 AP. But with a certain card, it only costs 1 AP. Huray!

So, 3 dice is the minimum. And I want the player to have a fail roll when he/she rolls at least 3 dice with a, 6?
5 and 6?
4, 5 and 6?

Kinda weird to do this in any dice. I need to invert the dice rolls. Telling it that a fail will be worth 1. And simply look at the chances to roll at most 2. In short words. I am fooling the calculator to do a calculation in a simple way.

It is a shame that I can't activate "at most" and "transposed" at the same time.

With 6 being the fail.
Number of dice: chance in % to succeed
1 and 2: 100
3: 99,54
4: 98,38
5: 96,45
6: 93,77
7: 90,42 and let me stop right here. This chance is to big. My goal is around 50% for 7 AP increased to 8 AP

With 5 and 6 being the fail.
Number of dice: chance in % to succeed
1 and 2: 100
3: 96,30
4: 88,89
5: 79,01
6: 68,04
7: 57,06
8: 46,82
9: 37,72 still rather big on 7 but 9 seems the opposite already. On the other hand, I need to consider the other AP cards and the chance to actually get this card in the team. Further, to get to 9, you need to pass the 8. Thus getting the card AND getting the upgrade.

With 4, 5 and 6 being the fail.
Number of dice: chance in % to succeed
1 and 2: 100
3: 87,50
4: 68,75
5: 50,00
6: 34,38
7: 22,66 waaaaay to low.

It is a decent result imho. Playtest imminent.

How to write the card??? Will this do?

Quote:
Roll a number of dice, equal to the maximum AP that the player may spend each round.
Roll less then 3 times a 5 or 6, and you receive 1 extra Action Point, every round indefinitely.

Clunky... this needs to be better described. Or the mechanic needs work once more.

X3M
Offline
Joined: 10/28/2013
To prevent confusion. I am

To prevent confusion. I am now mainly looking for a good card description.

Quote:
Roll a number of dice, equal to the maximum AP that the player may spend each round.
Roll less then 3 times a 5 or 6, and you receive 1 extra Action Point, every round indefinitely.

It.... doesn't sound so well.

Fri
Offline
Joined: 09/06/2017

never mind, I had a suggestion that did not fit the mechanism.

X3M
Offline
Joined: 10/28/2013
I did see the comment. You

I did see the comment. You got prety close. I was about to reply. Because the correct chance was there in the list. (5 or more successes for 7 ap, that is 5, 6 or 7 successes, instead of 2 or less ( which includes 0)) So 3 lowest or 3 highest successes. So your suggestion, the results had to be read a bit different. But I am going to play around with inverting etc. To see if something pops up that sounds better.

Fri
Offline
Joined: 09/06/2017
Here is my (reworked) attempt:

Roll the number dice equal to your current AP. Five and sixes are failures. If you roll less than 3 failures increase AP by one. Discard this card.

Also, you could possibly use two d6s verses AP may get the probability spread you desire. Worded like this: Roll two dice if your current AP less than or equal to the cumulative result, increase your AP by one. Discard this card.

2 100.00
3 97.22
4 91.67
5 83.33
6 72.22
7 58.33
8 41.67
9 27.78
10 16.67
11 8.33
12 2.78

X3M
Offline
Joined: 10/28/2013
Maybe this is better?

Roll ammount of dice, equal to your (current) AP per round. 1 and 2 are failures. Do not roll more then 2 failures: add 1 (extra) AP per round.

***

That the card is discarded after the attempt, is a given in this game.
Further, dunno if the (current) and (extra) should be added. They do emphasis how the card should work.

I will consider the 2d scenario as well. But the limit of 11 ap is not appealing for a certain special scenario.