Re: Unique patterns
- From: zacariaz@xxxxxxxxx
- Date: Tue, 11 Sep 2007 22:45:09 -0700
On 12 Sep., 07:25, Chip Eastham <hardm...@xxxxxxxxx> wrote:
On Sep 11, 6:18 pm, zacar...@xxxxxxxxx wrote:this is actually very usefull. Simple as it may be i just could find
1. Im sorry if i have posted in the wrong group.
2. English is not my native language and if i have trouble explaining
my self im sorry for that too.
3. This is NOT homework. I have gotten that message alot and its
simply enoying!
It has to do with cards. A deck of cards has 52 cards and a single
card can have 4 different suits and 13 different values.
I drawing two cards, obiously they cant be exactly simular. Also im
ignoring the order of the cards im drawing.
e.g.
52*51 / 2! = 1326 different hands
Okay, we need to map all possible pairs of cards
to a number between 0 and 1325.
A single card can be looked upon like this:
{Suit, Value}
fx.
NB! im using ranges starting from zero fx. 0-3 instead of 1-4.
{3,12} & {3,11}
The mapping from (Suit,Value) to a number between 0 and 51 is
Suit + Value*4 (assuming Suit is 0 to 3 & Value is 0 to 13).
the solution.
generel i dont like conditional statements in a formula, but as it is
This hand would equal Ace King or Queen King in the same suit,
dependent on Ace being assigned lowest or highest value, but it doesnt
matter here.
The goal is to somehow calculate this specific hands unique patter in
the range of 0-1325.
[snip]
We have two distinct numbers, by the mapping above, between
0 and 51. Obviously one is bigger than the other, say m > n.
If n < 25, let m + n*52 represent the pair.
If n >= 25, let (51-m) + (50-n)*52 represent the pair.
to be used in a computer program anyway, it doesnt matter much.
It should be clear that the smallest value representedThis may be usefull as it is somewhat simpler than what matt
here is 0 (from m = 51, n = 50). The largest value is
for n = 25 so that the coefficient of 52 is maximized,
and m = 26:
(51-26) + (50-25)*52 = 25 + 25*52 = 1325
The range of representations is 0 to 1325, as desired.
Such a formulation can be extended, albeit awkwardly,
to higher dimensions/larger card hands.
suggested, but i need to think it over.
regards, chip
thanks
.
- Follow-Ups:
- Re: Unique patterns
- From: matt271829-news
- Re: Unique patterns
- References:
- Unique patterns
- From: zacariaz
- Re: Unique patterns
- From: Chip Eastham
- Unique patterns
- Prev by Date: Re: JSH: SF Algorithm
- Next by Date: Re: JSH: Triumph of stupidity
- Previous by thread: Re: Unique patterns
- Next by thread: Re: Unique patterns
- Index(es):
Relevant Pages
|