From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_50,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1cf33a6af38ff007 X-Google-Attributes: gid103376,public From: mfb@mbunix.mitre.org (Michael F Brenner) Subject: Re: HELP anyone got this basic solution Date: 1997/04/02 Message-ID: <5hu0gp$4df@top.mitre.org>#1/1 X-Deja-AN: 230161453 References: <5hss1t$2k7@news.aus.world.net> Summary: the results are conjugates Organization: The MITRE Corporation, Bedford Mass. Keywords: HELP ADA Newsgroups: comp.lang.ada Date: 1997-04-02T00:00:00+00:00 List-Id: > Does anyone have any suggestions on writing a routine > in ada to sort a poker hand into > simple groupings ie pairs, flush, royal flushes etc Yes. Here is a suggestion. Since Intro to Ada is adequately covered in a myriad of textbooks, and sorting is adequately covered in, for example, Knuth, The Art of Computer Programming, Volume 3, Addison Wesley, it can be presumed that your question is how to recognize the hands in a unique way. In particular, you are asking for a recognition scheme applicable to other circumstances, above and beyond what might be taught in an intro to programming class. For the intro to programming class you would just make a data representation for the cards and use some procedures, IF statements, and LOOP statements to hack a game. However, you probably have an application you cannot disclose, for an unnamed agency, for example, recognition of intelligence signals at the listening post or the creation of more effiecient scheduling algorithms for moving the train cars between trains in the train yards. Actually, the solution given here also applies to certain robot scheduling problems, the false coin problem, categorical shape recognition, consonental metathesis (interchange) in linguistic evolution according to the Grimm theory, and cache estimates for the intermediate results of sort runs in computers with insufficient RAM to do a full population bucketed hash code algorithm. My suggestion is this. Present each simple grouping as an algebraic word in a group whose alphabet you can take to be the 13 numerical indices (including the royal cards) in three dimensional ordered pairs with the 4 suits together with (union) the 22 trumps as the second dimension, and the enumeration of the groupings as the third dimension, with the relationships represented by a certain number of interchanges (=), knots (=) representing the coding of the simple groupings. The each of the groupings is just a conjugacy class! That means by using the Baumslag theorem you can not only identify these conjugacy classes in the general pattern recognition case, but you can also avoid those kinds of groupings which would lead to the co-NP conjugate minimal normalization blowup, which is intractible. That way, your code could double as a poker game, an intelligence data handling system, a vizualization tool, and a resolver of a number of knotty (pardon the pun) braid-like scheduling problems. Assistance in doing this can be gotten from various 1990s group theory texts, and from the Magnus archive at City University of New York which has placed a lot of stuff like this on line on the net. There are a couple of things to watch out for: in the general case, you will need as many triply linked lists as you have relationships in the presentation, and you will need to handle internal scheduling of the Cayley graph collapses using still further data structures, however, this can be done with available public domain group-theoretic software available from two universities, or you can download the Ada version from the net of the word problem solver. The hard part is to generate test cases that cover all possible knots. To do this, I recommend a Tietze tranformation generator (TTG). Use the TTG in two ways: first, to generate random Tietze transformations, and second, to test specifically constructed examples based on published common groups, counterexamples, and one example for each knot. Finally, if you have enough computer power, you can use the TTG to generate a test case for every possible word up to a given length, identifying its conjugacy class, and tabulating the results graphically. Doing this in various groups usually results in a better understanding of the structure of the group. But the first step is to recognize that there is such a group of which your simple groupings are just the conjugacy classes, and then take off from there.