THKP

View Original

Beat Your Grandma at Cards... With AI - Chapter 1

"If you seek a pleasant peninsula, look about you." - Michigan motto

I grew up in Michigan a long time ago, and I recall four universal truths: lakes, beer, turn right to turn left, and grandma will always beat you at cards. Doesn’t even matter what game it is. War, bridge, schafkopf, baseball, or even some game that you invent in order to finally take her down. She will beat you. I’m convinced it’s encoded into the fabric of the universe. Oh, and grandma’s also make amazing pancakes.

Recently, computers have had much success against humans in games like chess and the ancient game of Go. These AI successes were against grandmasters in their respective games, but are computers powerful enough to best the all-powerful grandma? The purpose of this series of articles is to explore that very question. In this first article, I’ll keep it simple and just talk about how to play the game of Euchre. We’ll also define some important terminology that’ll be ubiquitous in this series.

The Game

My grandmother’s game of choice was a popular Michigan standby known as Euchre. If you’re not familiar with that game, that’s okay. It’s a very simple game, and I’ll give a quick overview in this article. I’ve chosen Euchre for two reasons:

  1. It’s a good toe-tipper into card game AIs. It has a lot of the same mechanics as more complex games like Pinochle or Bridge, but it has a fairly small “decision space”, so we won’t have to go too deep into optimizing (which is another very interesting aspect of writing AIs, but I’m not an expert, so I’ll stick to the basics for this series).

  2. Of all the games that my grandmother beat me in, Euchre was the most traumatizing, so I’m hoping writing this will help me work through the PTSD.

How to Play

Here’s a quick overview of Euchre for the uninitiated.

The Deal and Picking Trump

Euchre is played with a normal deck of cards with 2-8 removed. Therefore, there’s 24 cards in a Euchre deck. It’s a team based game played with 4 people, commonly referred to by the cardinal directions north, east, south, west. Opposing players are team-mates (north/south, and east/west).

The game starts with a dealer giving five cards to each player. This leaves 4 cards called the “kitty”. The dealer puts the kitty in front of her and flips the top card, and everyone can decide whether or not they want that suit to be “trump”. If no one wants it, the card is flipped back over, and everyone gets an opportunity to pick whatever suit they want for trump.

Playing the Game

Once trump is chosen, the person to the left of the dealer starts the game off by playing a card. Then, in clockwise order, the remaining 3 players all play a card. These 4 cards constitute a “trick”, and the highest card in the trick wins the trick. Play then continues with the winner of the trick playing a card. Play ends after all five tricks are complete, and the team with the most tricks wins the game.

Winning Tricks

I mentioned in the previous section that the highest card wins the trick, but how is card order determined? This is one unique aspect of Euchre. As I mentioned before, each game of Euchre has one suit that is referred to as “trump”. For the sake of card order, any trump card beats any non-trump card. A 9 of trump beats an ace of non-trump. Each trick also has a “lead suit”. This is the suit of the first card in the trick, and it may or may not be trump. Within a trick, cards of the lead suit are higher than cards of other suits (except trump, of course, which is always better than the other suits). So, for example, if trump is hearts, and I lead with a 9 of clubs, if everyone else plays spades, I win the trick with the 9.

Following Suit

Also, players must always follow the lead suit if they can. So if someone leads a 10 of spades, and the only spade I have in my hand is the 9, I MUST play it, even though it’s a losing card. Players can only play trump if it was the lead suit, or if they don’t have the lead suit. This is why being “short-suited” (meaning your hand doesn’t have any cards of a suit), is a good thing, unless, of course, you are short-suited in trump, which is very bad.

Card Order

In non-trump suits, card order is straightforward: A-K-Q-J-10-9. In trump, it’s a bit weirder. The highest card is the jack of trump, known as the “right bauer (1) (sometimes anglicized as bower)”, and the second highest card is the jack of the same color, known as the “left bauer”. So, if trump is spades, the order of trump cards is J♠-J♣-A♠-K♠-Q♠-10♠-9♠. The jack of clubs is actually considered a spade for the duration of the game, so all the rules about following suit and such apply to it as though it were a spade. Now, you may notice that this means there are 7 total spade cards, and only 5 clubs, and 6 of hearts and diamonds. Throughout this series, I will refer to these suits as the trump suit (spades in this case), the sister suit (clubs), and “off” suits (hearts and diamonds). I will also occasionally refer to an opposing or opposite suit, which is a suit of the opposite color, but more on that later.

Conclusion

That’s the gist of the game. If you’re interested in following along with programming the AI, I recommend getting out there and playing a few games. Invite three friends over and order some pizza. Maybe throw on some polka music. There are also several online Euchre sites. So try your hand to get a feel for some of the strategies. You’ll find it’s a surprisingly complex and satisfying game despite the simple rules. So good luck, and try not to cross paths with any Michigan grandmas.


1. Bauer actually means “farmer” in German, and a lot of other card games share this theme of “farmers” being a high value card in the game (like Pinochle having a 10 be the second best card). I guess this was the working class’s inside joke against the man. This factoid has no bearing on these articles, but hey, it’s interesting.