Ok, ...
Since we're working with simplified Omaha rules, I think I would
approach the problem something like this:
require'stats'
bestLow=: {{
cards=. y\:13|y
kinds=. 14|2+13|cards
hands=. 5 comb #y
ranks=. 13 #. (,.~ [: >./"1 #/.~"1) hands{kinds
(hands{~(i.<./)ranks){cards
}}
If we were using the full Omaha rules for where we pull the cards
from, I would change the definition of 'hands' to include that
limitation
If we cared about the distinction between two pairs and a full house
or between one pair and two pairs, I would incorporate that
information in the definition of 'ranks'. (And, I would do something
similar if straights and flushes mattered.)
Basically, I'm ranking hands by their value, and picking a hand with a
lowest value. And, I've tried to incorporate my understanding of the
rules in my representation of "value".
I hope this makes sense, and I hope that maybe it helps.
Take care,
--
Raul
On Sun, May 9, 2021 at 6:32 PM Devon McCormick <[email protected]> wrote:
>
> Raul,
>
> You are correct about the rules of Omaha but this is a simplified version
> of the problem. It is not intended to be Omaha-specific but could be used
> in Omaha with minor modifications.
>
> The left box result of "bestLow" contains the ranks as used after we have
> lowered the value of an ace (normally 12) to be lower than 2 - represented
> by 0 - so it becomes _1. This reflects a hack of my original high-hand
> poker code where ace is usually high but could be low in the singular case
> of a wheel.
>
> The right box is as you surmise but my point there is that there are
> multiple possible solutions because of the duplicate cards. However, any
> one of them suffices and there's no point in returning all of them.
>
> I hope this makes things clearer.
>
> Cheers,
>
> Devon
>
>
> On Sun, May 9, 2021 at 5:39 PM Raul Miller <[email protected]> wrote:
>
> > Looking at your code, and your description, I am a bit lost.
> >
> > (1) The rules for omaha suggest that when working with nine cards,
> > you're really working with a group of five and a group of four, and
> > that you must pick 3 cards from the group of five and 2 cards from the
> > group of four. But I did not see this implemented in the code, and I
> > did not see this restriction lifted in your commentary.
> >
> > (2) Looking at your bestLow implementation, I do not understand its
> > structure. I see a _1 in the left box and I don't know what that
> > represents. I look at your right box and take it apart as suit index,
> > card kind, and that looks correct for the cards in that example:
> > 14|0 2+"1]0 13#:25 41 16 18 6
> > 1 0
> > 3 4
> > 1 5
> > 1 7
> > 0 8
> >
> > But I don't understand that left box.
> >
> > And, between these two issues, and the wide variety of possibilities,
> > I can't see further into where you might want to be.
> >
> > What am I missing?
> >
> > Thanks,
> >
> >
> > --
> > Raul
> >
> > On Sun, May 9, 2021 at 3:43 PM Devon McCormick <[email protected]> wrote:
> > >
> > > I'm working on some code to work with low poker hands (as in a game like
> > > Omaha or lowball). Since not everyone is familiar with this domain, I've
> > > put together a wiki page outlining what this means and the code I have so
> > > far: https://code.jsoftware.com/wiki/User:Devon_McCormick/Poker/Lowball
> > .
> > >
> > > This may be part of the NYCJUG meeting (
> > > https://www.meetup.com/J-Dynamic-Functional-Programming/) in a few
> > days, so
> > > any suggestions are welcome.
> > >
> > > Thanks!
> > >
> > > --
> > >
> > > Devon McCormick, CFA
> > >
> > > Quantitative Consultant
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm