Yeah, It’s a confirmation, that this is the correct solution, but I guess, it doesn’t matter anymore, since the end result is deadlocked after two player submitted the whole correct list already. Everyone ends with zero point. Congratulation.
(40 C 5) is only 658,008 possibilities, so it’s not that long a thing.
In short, you:
- Create a deck of cards. Mine is an array of card dictionaries, each having a suit, rank, code (suit + rank), and value.
- Create an evaluation function for rating how good a hand is versus another.
- Iterate through each of the 658,008 possibilities, check if a hand’s values sum up to your desired value, and if so, call the evaluation function to see if it’s a better hand than the currently saved best hand. If it is, save that hand as the new best hand.
That final step looks like this:
def best_poker_hand(final_value):
best_combo = None
best_rank_tuple = None
for combo in itertools.combinations(deck, 5):
if sum(card["value"] for card in combo) == final_value:
rank_tuple = evaluate_hand(combo)
if best_rank_tuple is None or rank_tuple > best_rank_tuple:
best_rank_tuple = rank_tuple
best_combo = combo
if best_combo is None:
print("DNS")
else:
hand_type_str = hand_types[best_rank_tuple[0]]
cards_str = "-".join(card["code"] for card in best_combo)
print(f"{hand_type_str}: {cards_str}")
Yes and no.
One guess less means I wouldn’t be able to use my own guesses. (I used all guesses I was given.)
But also: I still have one guess in reserve thanks to the deal with Marshal.
NGL, I wanna host a number poker of my own.
Except I don’t make the best hands, and instead make whatever hands I think I can make.
And then, for every error I make, the players get a point.
Truly, a means of discouraging the exploration of the hidden numbers.
This probably cooked me because the big thing about the Enigma Machine is that it checks to make sure you can’t make a better hand that sums up to that value, so I’d have removed any hands where 103 was a Straight Flush or Four of a Kind.
Not blaming you for it - I’ve probably missed something in my program, and this game was still a blast.
Speaking of which, what was the sequence for Hearts and Spades?
You’d probably need to give a lot more info to players to make that function because it’s hard enough to piece things together as is, but that’d be interesting to play.
Hm… I think I have an easy fix.
8 Cards. 1 Joker. 1 Creation.
Of the 8 Cards, players can opt up to three times to make do my best to create the best hand.
Joker always gives best hand.
Creation lets you make the hand in my stead.
I kind of think the natural endpoint of this game is a “nobody/everybody wins”, mostly because players explicitly benefit from trading info, and gain nothing from keeping it to themselves, meaning players optimal move is trading basically all info in order to win, meaning it’s kind of a reverse prisoners dilemna in which if some people are cooperative, everyone has to be to stay competitive
I tried to be competitive at first, primarily by trying to trade the same bit of info with different people, leveraging 31 for as much info, and trying to trade other people’s info for their own info.
But ultimately, zone deduced all but 1 of the results i kept to myself anyways.
Oh, no. I definitely could have won if I were to lie about the prime numbers.
But that would be dishonorable, which is stupid.
I mean, yeah, unless people lie in the game, I suppose. Just none of us ever chose to do that.
There was a point I thought i might get it by round 7 or 8. I was actually planning to do what I accused you of (Fake DNS on a real number) but wanted the extra guesses.
this was mostly to mess up ash, because I assumed he would probably just throw that dns in his code, and then hopefully never figure out why it didnt work.
I mean, by Round 5, I reached the point where I just assumed all external info was incorrect because my program stopped working.
Fun fact: this is because Z3 is a useless bum that will quit and give no solution if it gets tired.
Did not realize this until I used the OR-Tools thing you gave me and found that my code was, in fact, working.
yeah. I figured that out about Z3… It worked up to a point, but once I tried to add DNS constraints with 40 cards I realized that it would be easier to just find some other constraint solver than make it work with z3
From what I’ve read, Z3 is apparently much better for Booleans than for Ints.