LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 08-30-2004, 02:12 AM   #1
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Math question... counting theory


Is there anyone here interested in helping me understand some counting theory? It's a rather long problem to describe and could be responsible for causing loss of sleep, hair pulling, and obsession. I speak from personal experience.

As a teaser it's a "deck of cards" problem trying to determine probabilities for drawing certain card combinations. This is not the classic poker probability calculations. Rather, it's dealing with a game I played back in high school and college: Magic: The Gathering. I've got a renewed, nostalgic interest, and wanted to do some analysis.

So, anybody here up for a combinations/probability math problem?

Dark_Helmet hears a pin drop...
 
Old 08-30-2004, 02:21 AM   #2
PenguinPwrdBox
Member
 
Registered: Oct 2003
Posts: 568

Rep: Reputation: 31
ROFL - I used to play Magic..........and I'm working 3rd now - let's do this
 
Old 08-30-2004, 02:45 AM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Original Poster
Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Alright, pertinent info:
60-card deck
4 copies of Arenson's Aura (1 White, 2 Colorless casting cost)
12 Plains
8 Forests

How many ways can I draw an opening hand (7 cards) and have the necessary cards to play Arenson's Aura. In other words, I have to draw at least one Arenson's Aura, I have to draw at least 3 land, and at least one of those three land has to be a Plains.

I'll use C( n, r ) to signify calculating the combinations. In other words:
C( n, r ) = n! / ( r! * (n - r)! )

So, the total number of ways to draw an opening hand is C( 60, 7 ) => choose 7 cards out of 60, and order drawn is not relevant
C( 60, 7 ) = 386,206,920

Ok, so to calculate the probability, we need to calculate how many ways an opening hand can contain the cards listed above. This is where I hit a serious snag. The different methods I employ give wildly different results. First attempt:

Have to draw 1 Arenson's Aura. That can be done in C( 4, 1 ) = 4

Have to draw 1 Plain. That can be done C( 12, 1 ) = 12

Have to draw two more land. C( 19, 2 ) = 171
Have to account that the Plain in the earlier step is no longer available, which is why I use 19 instead of 20 ( total land - 1 )

The remaining 3 cards in the opening hand can be from any left in the deck. C( 56, 3 ) = 27,720
Again, 4 cards have been picked, leaving 56 to choose 3 from

Soooooo... I figured the answer would be 4 * 12 * 171 * 27,720 = 227,525,760

And that would mean you have a probability of 227,525,760 / 386,206,920 = 58.9% chance

That doesn't sit well with my common sense expectation (and I sure don't see that combination come up 1 out of every 2 opening draws). So I did what any self-respecting computer geek would do. I wrote a program to count the possible opening hands and also did it by hand. The program and the hand calculations differ (still tracking down the difference), but I trust the program more than my ability to punch numbers. Anyway, the program said there were only 50,769,368 possible opening hands that met the criteria. That gives a percentage of about 13.1% (which sits much better with me).

So, the question is, what is wrong with the method above? I haven't been able to work backward from the result, and other methods I've tried have failed miserably. Any ideas?

Last edited by Dark_Helmet; 08-30-2004 at 02:48 AM.
 
Old 08-30-2004, 05:10 AM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Original Poster
Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Hehehe... didn't know what you were signing up for did you?

I've found a method that agrees with the computer's brute force approach, but it's anything but simple. Essentially, the method I posted above was "overcounting". As an example, say I pick the first copy of Arenson's Aura in the first step, and then pick the second copy of Arenson's Aura after picking the land. That selection is no different from picking the second copy in the first step, and then picking the first copy after the lands, but both were being counted as "unique" with that method. In other words: "Bad, bad Dark_Helmet!".

This dampens my hopes of writing any sort of deck analysis tool. I had grand plans for calculating probabilities for a deck to "unlock" (hit it's special card combo). To calculate it, you have to exert some non-trivial intelligence to break up the problem. Otherwise, it's brute force, and that's not really an option. After the first few draws, the combinations become prohibitive. For example, at turn 6, you've drawn 12 cards out of a 60-card deck. That's C( 60, 12 ) = 1,399,358,844,970. Even super-fast machines will slow down trying to cycle through almost 1.5 trillion possibilities.

If you're curious (our just bored to tears), I can post how I got the same number as the computer.
 
Old 08-30-2004, 08:34 AM   #5
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
i usually use a more simple approach, i tend to just give each card type a possibility out of the number of cards (i have a deck about 90 cards big, i think about 30 lands, and every creature is unique (i think every card except land i unique in that deck actually .... haven't played in a while)

anyways, instead of brute forcing the issue, why not just accept probability's and use those to determine a "good" hand from a bad one (and i think you want 8 cards, as you get 7 cards to start with, then draw one before your turn)

anyways, just in the few minutes i though and wrote on paper i got the number thats about 2% (ok, so somewhere between 2-3% I'm lazy and want to sleep so I'm not finishing the division ) plus i think i messed up, i got 4/180 for the needed cards, but you get 4 more so ill just say 7% chance of getting a overly good hand, now I'm going to bed good morning all (i hate sleeping at night)

wellp hope you solve whatever it is your trying to do ..
 
Old 08-30-2004, 08:41 AM   #6
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
This kind oflooks like the sort of thing you are after. This guy discusses a number of aspects of Magic and probability.

This was my search. I was only slightly surprised (raised eyebrow surprised) to find a number of sites discussing similar problems
 
Old 08-30-2004, 03:27 PM   #7
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Original Poster
Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
SciYro:
Doing a rough estimate might end up being the route I take. I have a perfectionist streak that's at odds with doing that, but my realist streak is starting to beat the living daylights out of the perfectionist.

Oh, and about the 7 versus 8 card thing. You're completely right. According to the rules, you draw one at the beginning of your first turn. The people I used to play with though did things a little different, and followed tournament-style guidelines. Each player rolls to see who "gets the option". The options are playing first or drawing first. That is, the person who plays first sacrifices their first draw. It's an attempt to make starting out a little more even. It's debatable whether it's more fair or not. While the first person to play doesn't get an 8th card (limiting their options), that also means they can last for one turn longer without having to discard. It also means that if both players have equal-sized decks and draw 1 card per turn, then the player that plays first will win if the decks are exhausted.

Geez, I need help. Apparently my analysis streak is beating the crap out of both the perfectionist and the realist streaks.

XavierP:
I didn't expect there would be many links about it. I figured this was uber-geek territory, especially since it deals with some complex concepts that I was exposed to back in college. Part of my coursework included a "Discrete Mathematics" course that dealt with counting methods, set theory, probabilities, and all sorts of other good junk.

I haven't taken a look at all the links yet. Maybe I'll find something that will "unlock" the situation for me... Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
graph problems - python is the language but math is the question cs-cam Programming 3 09-03-2005 10:33 PM
stuck again (noob bash math question) babag Programming 6 04-25-2005 01:27 AM
IP addresses and web-servers: n00b theory question tireseas Linux - Networking 11 03-13-2005 10:04 PM
math/probubility/gambling question true_atlantis Programming 12 10-16-2004 04:21 PM
question about dns theory eantoranz General 0 09-07-2004 12:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 09:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration