Unique patterns

Programming, for all ages and all languages.
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Post by Kevin McGuire »

Thanks. I appreciate the explanation.
Zekrazey1
Member
Member
Posts: 37
Joined: Sat Mar 10, 2007 8:28 am

Post by Zekrazey1 »

You're welcome. If it looks like I went backwards, it's because I did ;). I didn't realise there was a neater way of looking at it until after I'd gotten to that last equation (x^3 - i*x^2 + i*x - k = 0), came back to it after a few hours and my brain turned a cog :P.
User avatar
Zacariaz
Member
Member
Posts: 1069
Joined: Tue May 22, 2007 2:36 pm
Contact:

Post by Zacariaz »

Just one last question, then i wont bother you anymore ;)

The stuff suggested so far, focuses, if im not mistaken, on generating an unique pattern from which the original values can be (cant seem to find the right word) calculated.

e.g. values -> pattern -> values

but what if what if i only need the unique pattern and not the ability to do the stuff backwards?

fx. still focusing on cards.
2 cards give 1326 unique combinations, not focising on the order. 52*51 / 2! = 1326
0 - 1325 should be the values the patters could contain.
of course sorting them would still be the easy aproach, but it would give a pattern of a different type, a pattern where the cards involved can be recognised. this is not wanted in this scenario. The reasons are hard to explain, maybe ill try later.

e.g.
50, 51 = unique x
51, 50 = same as above
50, 51 = same as above
50, 49 = new unique x
etc.
and all these paterns is unique and in the range 0 - 1325

basicly:
S=suit, V=value

S{s1, s2} == 0 - 15 (s1==s2)?(v1!=v2):(s1!=s2)
V{v1, v2} == 0 - 168 (v1==v2)?(s1!=s2):(v1!=v2)

this however does not exclude the order from the pattern, which is most important.

edit:
i just read this through a couple of times and realise that i my self would probably have a hard time understanding it, and the purpose, but i dont think i can do any better.
ask questions if needed and ill try to answer, or refrain from answering.

Thanks
Zekrazey1
Member
Member
Posts: 37
Joined: Sat Mar 10, 2007 8:28 am

Post by Zekrazey1 »

If there's a one to one relationship between set of cards and ids, then you will always be able to go backwards (though it may be extremely difficult depending on the function). There wasn't really a focus on that. The focus was on functions that don't care about the order of their arguments.

As for whether there's a nice equation that packs all the ids into the smallest range possible, that would require more maths :P. Maybe it's as simple as performing some modulos somewhere.

[edit]
I randomly tried some things, and found that taking i, j and k modulo 53 seems to work (not 100% certain though). That'd let you fit everything into 18 bits. It's the smallest prime above 52. I have absolutely no clue if that's just a coincidence.
User avatar
Zacariaz
Member
Member
Posts: 1069
Joined: Tue May 22, 2007 2:36 pm
Contact:

Post by Zacariaz »

posted my problem at http://groups.google.com/group/sci.math ... 8c6eeb6adb

Actually got a solution allthough aomewhat complicated.
Zekrazey1
Member
Member
Posts: 37
Joined: Sat Mar 10, 2007 8:28 am

Post by Zekrazey1 »

That requires sorting the cards in the hand :P.

[edit]
Removed something in my post because it was incorrect.
User avatar
Zacariaz
Member
Member
Posts: 1069
Joined: Tue May 22, 2007 2:36 pm
Contact:

Post by Zacariaz »

Zekrazey1 wrote:That requires sorting the cards in the hand :P.
I know, that is whats enoyingme the most, and the secont thing is that i would probably nee some sort of recursive function, which im very bad at...
Post Reply