Tag Archives: poker

Boulder Buy’em Poker

The boulder gamedev club had a card game jam this week. My group made a poker variant. It’s pretty good (it received the high praise from Namaste, “I’m not sure if it’s better than no limit Texas Hold’em”). The game has been dubbed “Boulder Buy’em” by Paul Steinbrecker. Here are the rules.

Each player, as usual, starts with some chips somehow. There’s a dealer button on one of the players, and it rotates clockwise each round.

Something to note while reading this: there is no “dealing”, and players do not receive a new hand each round. Instead they build their hand over the course of multiple rounds.

The round proceeds in several phases:

  1. Ante
  2. Auction
  3. Claims
  4. Discards

The Ante phase is just an ante. Each player puts in a fixed ante.

The Auction phase is quite unlike any other poker game. Cards equal to the number of players are placed on the table, 2 of them face up1, the rest face down. It’s an auction for first choice of cards to put into your hand. The player on the dealer button makes a fixed blind bid (double the Ante in our playtests). Then there is a free auction without ordering (just calling out numbers with the dealer acting as the auctioneer); for cases without a dedicated dealer, it’s possible to use a turn-based auction style. There is no minimum increment for bidding, except as restricted by the chip values (it is perfectly reasonable for the blind to be 10, someone to bid 100, and then someone else bid 105). The winner of the auction pays the amount he bid, everyone else pays nothing. The winner then takes a card from the table of his choice, face up or face down, and the rest of the players take cards from the table in clockwise order.

The Claims phase is much more like a traditional poker hand. Most rounds there will be no claims, but the dealer should make the request for claims each round. The first person to say “claim” after the request initiates a claim. He chooses any number of cards from his hand and places them on the table face down in front of him, optionally in addition to some chips (as an opening bid). Then, proceeding clockwise around the table, each player has the standard options (raise, call, fold). When a player raises or calls, he chooses cards from his hand to put on the table. If the number of cards the player plays exceeds the maximum number of cards anyone has on the table, then it “counts” as a raise in terms of actions: everyone else gets another chance to act. It also counts as a raise if it was a monetary raise, of course. Whenever a player acts, he gets a chance to put more cards on the table face down in front of him, but not to remove any cards.

When the bidding completes, everyone is either folded or has the same amount of money and some cards (not necessarily the same number) on the table (modulo all ins). There is then a showdown. Starting with the last person to bid or raise, proceeding clockwise, a player can show his cards or muck. The best hand takes the whole pot, including the pot built up over the past few rounds from the auction phases. All the cards which were played on the table are reshuffled into the deck, including those of folded players. Players get to keep cards which they never played on the table.

On the Discard phase, all players who have more than seven cards in their hand choose cards to discard down to seven, and the dealer reshuffles those into the deck.

In tournaments, if a player does not have enough for the ante, he pays whatever he can into the ante. No special splitting is necessary in this case (think about it). It is strongly advised to claim that round (because otherwise the player is definitely out).

If the player on the dealer button does not have as much as the blind bid, then the blind bid is equal to the player’s stack and starts from there. That is, if the blind is 50, but the player only has 10, then the blind is considered 10 and it is perfectly reasonable for another player to bid 15.

If a player wishes to sit out, he must sit out until the round after the next claim, so his next ante will be into an empty pot. Harsh and variable, I know. This is necessary to keep player from sitting on a good hand not paying ante until the pot is huge.

1During heads up, only one of the two cards is face up. All the other rules remain the same.

Haskell State Accessors (second attempt: Composability)

Last week I introduced some constructs to make programming games with Haskell easier, mostly the idea of an accessor for dealing nicely with highly stateful functions. The (refined once) abstraction looked like this:

data Accessor s a
    = Accessor { getVal :: forall m. MonadState s m => m a
               , setVal :: forall m. MonadState s m => a -> m ()

The theory was, you had your global state data structure, and you could define accessors into pieces of it. So for example, if you had the following state:

data Foo = Foo { p1score_ :: Int, p2score_ :: Int }

You (or a TH module) would define:

p1score = Accessor (gets p1score_) (x -> get >>= s -> s { p1score_ = x })
p2score = Accessor (gets p2score_) (x -> get >>= s -> s { p2score_ = x })

And then given the Accessor abstraction you could do stuff like define a := operator for readability and whatnot. I was proud that you could write accessors that accessed things other than the top level of the data structure.

But something still wasn’t right. I wanted to be able to do something like a.b.c in OO langauges, where a, b, and c were accessors. So here is my new Accessor abstraction:

The idea is that an Accessor is an object which accesses a value of type a as a function of a value of type s (I call it s for state, the typical value). But it no longer has anything to do with a monad, it’s an abstraction simply for extracting data from other data. The new signature is:

data Accessor s a
    = Accessor { getVal :: s -> a
               , setVal :: a -> s -> s

getVal retrieves an a from an s, and setVal inserts an a into an already existing s.

UPDATE: I require the following laws to hold in order to ensure that this is actually behaving as an accessor:

getVal a (setVal a x s) == x
setVal a (getVal a s) s == s

As usual in Haskell, this simplified version is much more powerful than the more complex one above. In particular, we may define a composition operator:

(@.) :: Accessor a b -> Accessor b c -> Accessor a c
f @. g =
    Accessor { getVal = getVal g . getVal f
             , setVal = c a -> setVal f (setVal g c (getVal f a)) a

That is to say, @. takes an accessor from a to b and from b to c and generates a way to access c from a, bidirectionally.

We may also define the previous State monady getVal and setVal like so:

getA :: MonadState s m => Accessor s a -> m a
getA acc = fmap (getVal acc) get

putA :: MonadState s m => Accessor s a -> a -> m ()
putA acc x = get >>= put . setVal acc x

modA :: MonadState s m => Accessor s a -> (a -> a) -> m ()
modA acc f = fmap f (getA acc) >>= putA acc

Given the appropriate (automatable) definition of accessors for foo and bar, we can do things like this:

data Foo =
    Foo { foo_ :: Foo
        , bar_ :: Int

modA (foo @. bar) (+1)        -- increment foo.bar by 1
liftIO . print =<< foo @. foo @. foo @. bar

I plan to write a TH generator for such accessors in the near future.

Here is a test demonstrating the idea and showing that it can work.

Werepoker bidding

All week I have been trying to program Werepoker and giving up after the first 20 minutes or so. I think that’s partially because it’s needlessly tough networking and threading, and partially because I know there is a high probability that the program would never be used. Well, I want to play werepoker tonight at GameDev, so I want to implement something. I think I will implement the minimal computer assistant necessary for the game to function: the bidding.

The situation: a silent auction. Everyone puts in bids for the roles they want; i.e. how much they are willing to pay for a particular role. Then we assign roles according to the bids. But there are lots of little edge cases to worry about: what to do in case of a tie, what about when someone wins two roles, etc.? The metric we will use to decide these edge cases is fairly obvious, namely to maximize the total amount everyone pays (that’s what you want to do when you’re holding an auction).

Let’s formalize this. For each player p ε P, there is a bid function bp: R -> $, where R is the set of roles, and $ is the set of nonnegative amounts of money. We’re trying to find an assignment function a: P -> R that maximizes Σpbp(a(p)).

Thanks to Daniel Crumly for pointing me at the Hungarian algorithm to solve this problem.

Hmm, the Hungarian algorithm won’t work for this problem, because it needs to be predictable by players. If you bid higher than anyone else on something, it’s still possible that you won’t get your choice depending on other bids. I’m thinking I’ll use a simple heuristic greedy algorithm.

It goes like this. Sort all bids, highest first. Give the highest bidder his wish, and remove him from the candidates. If there is a tie for the highest bidder, choose the one with the lowest secondary bid (because he is likely to pay more for a different role), or tertiary in case of a tie for that, and so on. Of course, if the bids are identical then just choose randomly.

Gambling problem

I’ve thought of a gambling problem (read: probability problem) that I can’t seem to solve using the methods I know of. The problem is to find an optimal playing strategy for the following game:

Pay me $100. I give you one chip (worth $1). You can decide to keep your $1 and walk away (down $99) or flip a coin with me. If it comes up heads, then you have three chips. If it comes up tails, you walk away with nothing ($100 down). If you have three chips, then you can walk away with $3 ($97 down), or try for nine chips. And so on.

The thing that makes this game hard to analyze is its infinite expectation. Every time you go for the coin, your payback is greater than your odds. For instance (ignore the $100 for now): I have one chip. I can walk away with $1. Or I can flip and get 0 1/2 of the time, and 3 1/2 of the time, for an expectation of 1.5 chips. Clearly I should flip. The exact same reasoning happens at every stage of the game. You hit every time, and you end up losing it all, because the coin is going to come up tails eventually.

It has something to do with that $100 for one chip (Keep in mind that hat’s the only way you can play this game). Because without it, the game is pretty easy to analyze. Give me some money, and I’ll triple it with 1/2 probability, or take it all. To play that in real life, you just play with amounts of money such that if you lose, you can play again. Play with $10. Get $30. Play with $10 again. Lose it. Keep playing like that and you can get as rich as you want.

Planned Play

I’ve adopted the strategy of making planned plays in Poker. I usually make my concrete plan on the flop, from a loose plan preflop. I’ve found that this strategy takes my play to a new level, and I’m beginning to conjecture why it works so well.

I think the main reason it works well for me is that it takes my mind off my cards, and off the strategy, and puts me in observation mode. It’s the same reasoning as waiting until your turn to look at your cards: it’s not that you give away information when you look, it’s that you miss information being given to you because you’re busy thinking about your hand.

It also allows you to focus on acting and social manipulation without delay. You can convincingly act like you were gold from the flop (only if the flop is paired or scary in some way, though) when the turn comes, because you were expecting to act like that. If you wait until the turn to make that decision, your acting will be nervous and hesitant.

Namaste points out a big flaw in planned plays in poker: anything can happen on the flop or the turn. I’ll point out a key part of my strategy to counter this. My antennae are up when I’m playing. If a card comes that matches a hand I put somebody on, or that is inconsistent with my plan, I make a new plan. Most of the time this plan is to go into shut-down. But if there’s a big pot, then I’ll reconsider everything and think about how I could possibly get this pot.

In general, making plans and deciding when to follow through is just easier than deciding what to do at every stage of the game. That’s why I think it works.

Misère Poker

I’ve been pondering a misère poker tournament. A misère game is a modification of a game where each player tries to lose the original game (modified with peer assistance from “where you try to lose,” because you never try to lose). So the first one out wins.

What kinds of hands would you play? Low ones, of course. But you’d try to convince your opponent that you’re beating him but you don’t know it. This is a hard thing to do. I wonder if some modification of the game is necessary, like if you fold you take the money in the pot (misère chess needs modifications to be interesting). If I can figure out an appropriate modification, we’ll play one at 6:30 next Saturday.

Another not-quite-so-esoteric variant I’ve been considering is a “bounty-only” game. Everyone puts up, say, $5 in front of them. When you take someone out, you take their bounty and add it to yours. Here’s the kicker, though: if you take someone out and they have more bounty than you, then they get to keep the difference. That is, you can only take as much as you have. We might play that next Saturday, too. I’m going to do it before our 7:30 game, so those who just want to play regular Hold’em As God Intended It can.

Poker Moneys

My PartyPoker account currently has $250 in it after a $80 buy in. This was after accumulating up to $300 then dropping down to $100, both very quickly. The $150 since then has increased very steadily, something like $30-$50 a day. That makes me feel much better about my playing.

My home game has corrupted me somewhat. We all know each other so well that we don’t need cards to play each other anymore. My brain falsely generalized my home game strategies to online, and it turned out to work very differently. That loss forced me to tighten up and fall back into the security of playing my cards.

I’m once again learning the differences between the various types of hands. I’m re-learning why you call with 89 suited against a big stack big raiser, and fold the same thing against a small stack big raiser. And I’m learning it quantitatively this time. I always knew why: implied odds. If I hit it big, I can get this guy’s whole stack. But now I’m seeing that I do in fact hit it big and pick up a whole stack here and there. I’m stealing less, because I can sit back and wait for an opportunity to bust someone, which is a lot more profitable and a lot less risky than stealing every other hand.

Unfortunately, my tournament play has suffered. In learning how to beat the ring games, I’ve forgotten how to get my stack up quickly and start controlling the tournament in order to take it to the end before the blinds kill me. There’s another thing I have to re-learn. My brain seems to have trouble switching styles like that. It can easily switch styles in the middle of the game for deception purposes, but to switch based on the game I’m playing is somehow harder.

Anyway, I think the answer is to play more. I’m the kind of person who doesn’t just “call along”: I aspire to beat the game and beat the players. It’s not about the money. In that respect, the more I play the better I’ll become, and that’s ultimately a good thing since I love the game. If I want to start playing higher stakes, and everyone does since the game gets too easy at the lower ones1, I’d better get to know my game pretty well. So expect more poker updates in the near future.

1If I go back to the site where I used to play2 and play the $0.01/$0.02 no limits nowadays, I get so bored. I am quite profitable on a relative scale, too. I make about $1 every ten minutes, which is equivalent to $25 every ten minutes at my current stakes, which would be pretty damn good. It’s just so amazingly easy; I can read everyone like a book. Which is a good sign because two years ago I was struggling to break even on those stakes.

2The name of this site has been removed because they blog-spammed me.

Reversing Play

Poker night tonight. We’re all coming to the point where we’re considering what each other player is thinking (including myself). I thought that we had reached this point a long time ago, but now that I bring it up honestly, it seems that’s not the case. We managed to get to a fairly advanced level of strategy without it, but now that we’re here, things are going to get very interesting.

For some reason this technique never occurred to me before: reversing the slow/fast play. Let’s take the fairly common case of a flop like A66. Now, the usual thing to do for an adept player is to bet if you’ve got the ace (to keep draws out), and wait until the turn to bet if you’ve got the 6. Now, the latter play is meant as deception anyway, but if everybody does it, it’s certainly losing its deceptive quality. So why not check raise if you’ve got the Ace (careful about reading for the 6, though)? And why not bet out immediately if you’ve got the 6?

If you bet out immediately, anyone who’s half-way active will think you don’t have it (the totally passive players may just get scared off and fold), and raise you with, say, the Ace. Second, a check raise always makes people think twice about what you might have. So if you check raise with the Ace, you can be pretty sure whether you’re ahead or behind after the opponent acts, and get out before you have to guess at the turn with high pair.

Of course, this strategy must be mixed up with the “usual” way to do it. Especially with the check-raise, you become very trappable, so you must keep your opponent guessing. Is this not the story of poker?

This took me so long to figure out, and now it seems obvious.

Andy Dick

I’ve just made a Poker enemy. His name is Andy, and I first met him at his $50 buy-in tournament. He said that he doesn’t want to play with me anymore. This is usually a good sign for a Poker player.

He’s a gambler. He calls everything, supposing he has anything at all. He takes pride in his accurate-about-half-the-time reads. He’s very agressive psychologically: he rips me to shreds any time he gets the chance, and Namaste says he does the same to him, when I’m not around :-). It seems like he’s steaming before he even gets started.

It is my duty as a solid Poker player to take money from people like him. If it were online, or at a casino, I’d be more than happy to take his $70 (the amount he lost tonight) and send him home crying. But the point of my home game is not to make money. The point of my home game is to have a fun night with my friends, learn something about cards, and hopefully make a few bucks while I’m at it. So in that respect, I’m disappointed that Andy doesn’t want to play with me anymore.

I honestly don’t know what his problem with me is. We have disagreements about how the game should be played. He’s for a max buy-in about 25-50 times the big blind. I’m for no max buy in, or if so, at least 100 times the big blind. It seemed like every decision I made about how to play the game he disagreed with. And even things that are standard practice he took me up on. I think we just have a general clash of personality.

Anyway, he did make the game more stressful, and not very much fun, so it’s partially good that he’s not coming back. In other news, I don’t think we’ll be doing a ring game anymore: the losers lost waay too much, and it wasn’t as exciting (no heads up at the end, all-in draws for the whole pot, etc.). We’ll go back to a couple of tournaments per night next week.