ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

Implement SoHe #621

Closed ctm closed 3 years ago

ctm commented 3 years ago

Implement the SoHe game as described by Rich on the BARGE mailing list:

each player dealt six cards to be split into separate Hold'em and Omaha high hand; pot is split between best Hold’em and Omaha hands … In SoHe the hand is split before the flop and is high only, but I’m sure if there’s interest a cash game could play high-low or try different variations of when the hands are split.

Denote which is which by putting a gap between the second and third cards, then use Dragee's List method to make the dragging natural.

Try to get this done today (Monday, June 14th) so I can demo it at AGDG tomorrow.

ctm commented 3 years ago
ctm commented 3 years ago

List sorts by y value unless an explicit getDistance or sorting function is passed in (unless they're all the same, which we can do with a constraint, I think). See the demo for an example that uses getDistance.

ctm commented 3 years ago

Ugh. Currently DrawType is Copy and the RangeInclusive that specifies the amount of cards that can be drawn is carried around separately. That works, but I want to add Set to DrawType and Set will have no corresponding range, so, I'd like to add the RangeInclusive into DrawType, but RangeInclusive itself isn't Copy. Additionally, I have a vague memory of trouble serializing enums that include ranges using the wonky cbor stuff we're currently using, so ...

I've added a spike to try to make a better DrawType, since in the long run that's in our best interest (i.e., it'll make passing cards easier). OTOH, I'd like to get something demonstrable today, so I'm willing to take the tech debt hit if I run into serialization trouble.

ctm commented 3 years ago

Sure enough, I did my spike and finally got the code refactored only to get a deserialization error. I'm pretty sure I can get around it by changing the RangeInclusive<u8> into two u8s.

ctm commented 3 years ago

Two u8s solved the issue. Yay.

ctm commented 3 years ago

I've had no luck with List, so for the near future I'll just have people select the two cards they want for the Hold'em hand and then click the Set button.

Unfortunately, I need to stop developing for the day and get ready for my demo this evening. That context switch is going to be super annoying, but it is what it is.

ctm commented 3 years ago

I think we want a new message sent to the server SetCardOrder and a reply of CardOrderHasBeenSet. Both will contain the cards in the order that makes sense for the game. For SoHe, that means two Hold'em cards followed by four Omaha cards.

The thing I haven't yet determined is how to translate the response into words. I think we want a response like:

Your Hold'em cards are As Ad, Omaha cards Kd Qc Jd Ts

One way to do it would be to make CardOrderHasBeenSet set to be an enum that specifies what game the setting was made for. That would be redundant info, but would give us the translation for free since we already can translate a response to English when no further context needs to be supplied.

Another way to do it would simply to special-case CardOrderHasBeenSet and have it call something from the shared library that interprets the result.

I think returning the enum, although redundant, is what I'll implement later today. I simply don't have enough examples of games where setting hands is part of the play to make a decision. Doing it this way will accommodate Chinese Poker which may become important at some point.

ctm commented 3 years ago

I wound up doing it differently than in my previous comment, but it's done and ready to deploy. I'll get it out either between this evening's game and tonight's game or tomorrow morning.

ctm commented 3 years ago

After deploying, four different bugs were found and fixed, but I believe it plays properly now.