Talk About Network

Google





Programming > Assembly Language > Re: I pee in th...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 20 Topic 5075 of 5194
Post > Topic >>

Re: I pee in the open

by "Rod Pemberton" <do_not_have@[EMAIL PROTECTED] > Jul 19, 2008 at 04:13 AM

"H. Peter Anvin" <hpa@[EMAIL PROTECTED]
> wrote in message
news:48810604.6070103@[EMAIL PROTECTED]
> Rod Pemberton wrote:
> >
> > Houston, we have a problem...  It appears that's combinations
(un-ordered
> > set).
> >
>
> Right, nPm = n!/(n-m)!.
>
> > A deck order of 1,2,3,4,5 is distinctly different from a deck order of
> > 2,5,4,1,3.  The game needs to keep track of the deck order.  The
remaining
> > five cards could be 1,50,23,37,9.  I'd think we'd want permutations
(ordered
> > sets).  For 52 cards:
> >
> > 52!=52*51*... = (big number Wolf posted)
> >
> > For five cards remaining:
> >
> > 5*4*3*2*1 / 1! = 120
> >
> > So, I asked: if 1,2,3,4,5 is ranked as first of 120 permutations of
> > 1,2,3,4,5, and all permutations are ranked from 1 to 120, what
permutation
> > out of 120 is 2,5,4,1,3?  (I used example value 33.)  Is there a way
to
> > generate the permutation from this rank number? Or, vice versa?
>
> There is, it's just awkward.
>
> In the case of the card deck, take the permutation number P:
>
> Make a list, deck[] of all the cards.
>
> card[0] = deck[P mod 52]
> P <- P div 52

If P can be 1...120, and P is < 52, div underflows...  Yes?

> Remove card[0] from deck[].
>
....?...?

There are not 52 cards left, but 5 left.  You know what their values
are:1,2,3,4,5, but you don't know their order.  They could be 1,2,3,4,5 or
1,2,3,5,4 or 1,2,4,3,5, or 1,2,4,5,3, etc. etc.  Since you don't know
their
order, you'd like represent them as a deck of 5 cards ordered 1,2,3,4,5
and
a use some method to order them properly.  Now, you need some way to
represent their actual order and a way generate it.  Is there a value that
can represent of each of these orders?  Is there a method to generate each
of these orders given that value?  E.g.,

zxcv(Q), Q=1, zxcv(1)=1,2,3,4,5
zxcv(Q), Q=2, zxcv(2)=1,2,3,5,4
zxcv(Q), Q=3, zxcv(3)=1,2,4,3,5
zxcv(Q), Q=4, zxcv(4)=1,2,4,5,3
etc.


RP
(Okay, I think it's time to let this question go...)
 




 20 Posts in Topic:
Re: I pee in the open
"Alexei A. Frounze&q  2008-07-14 01:15:57 
Re: I pee in the open
"Rod Pemberton"  2008-07-14 05:39:09 
Re: I pee in the open
"Wolfgang Kern"  2008-07-14 13:18:06 
Re: I pee in the open
"H. Peter Anvin"  2008-07-14 13:03:34 
Re: I pee in the open
"Wolfgang Kern"  2008-07-14 22:50:38 
Re: I pee in the open
Phil Carmody <thefatph  2008-07-15 03:25:24 
Re: I pee in the open
"Rod Pemberton"  2008-07-15 05:01:34 
Re: I pee in the open
"Wolfgang Kern"  2008-07-15 11:43:35 
Re: I pee in the open
"Rod Pemberton"  2008-07-15 08:39:19 
Re: I pee in the open
"Wolfgang Kern"  2008-07-15 18:56:35 
Re: I pee in the open
"H. Peter Anvin"  2008-07-18 14:07:16 
Re: I pee in the open
"Rod Pemberton"  2008-07-19 04:13:29 
Re: I pee in the open
"H. Peter Anvin"  2008-07-19 19:18:14 
Re: I pee in the open
"Rod Pemberton"  2008-07-20 14:45:57 
Re: I pee in the open
Robert Redelmeier <red  2008-07-21 03:01:16 
Re: I pee in the open
"Rod Pemberton"  2008-07-21 04:18:57 
Re: I pee in the open
Robert Redelmeier <red  2008-07-22 23:14:35 
Re: I pee in the open
"Rod Pemberton"  2008-07-22 22:31:27 
Re: I pee in the open
Robert Redelmeier <red  2008-07-23 18:21:47 
Re: I pee in the open
"Rod Pemberton"  2008-07-23 18:41:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 15:45:24 PST 2009.