Tag Archives: code retreat

Poker Programming Challenge

Last week Saturday, 26.April 2014,  a few curious developers gathered together at the Morgan Stanley offices in Budapest to learn about a new type of challenge: Lean Poker.  Everyone was excited and after a short introduction the game started. The croupier was already dealing out cards, collecting responses and measuring points. One thing was missing though: not one program was yet able to respond to any move requests. All of them were just sitting there frozen.

You find the event on this link:

Lean Poker @ Morgan Stanley

Saturday, Apr 26, 2014, 9:00 AM

Morgan Stanley Business Technology Centre
Lechner Ödön fasor 8.

17 retreaters Went

English:Due to the success of the new Lean Poker format we will do one more event this spring. Lean Poker is a continuous delivery and lean startup workshop built around a robot poker tournament. You don’t need to know poker, will teach you in the first half an hour! There is no price for the winner except for a round of beer the other teams may …

Check out this Meetup →

Background

Let’s get back to how it started: What is LeanPoker? It is a workshop for developers to practice and improve coding skills, especially agile development and continuous deployment. Participants are divided into groups and competing with one another using algorithms in different programming languages.

These type of workshops existed before, just they were not as competitive and exciting as Lean Poker. The father of Lean Poker is called Coderetreat, although in itself it is also just a few years old, existing since 2009. Rafael Ördög organized many such events and came to the idea to iterate it further using the poker rules for a poker robot competition. Thus Lean Poker was born in January 2014.

At least 60-70 developers participated in Coderetreats in Budapest already, so it was not difficult to find 13 coding heroes for this event. Only one of the following language was required:

  • C++
  • Go (Under review)
  • Groovy (Under review)
  • Haskell
  • Java
  • JavaScript
  • Perl
  • PHP
  • Python
  • Ruby

Actually not even these programming languages were required, a few participants came just to enjoy the fight and have a great time. A casino for developers and math fans.

Preparation

I can program in C++, Javascript and PHP, but for this purpose PHP seemed the most comfortable tool I could think of. So Attila, Gergely and I formed the PHP team. Gabor joined later on and we choose the name “AllLean”. (For non poker players this refers to “All in”, a term I will describe later on.)

One “sit and go” looks like above. It means that all the teams grab 1000 USD and start to play.  They play until only one player has any money left. Then the first player gets 5 points and the second best get 3 points. This measurement system leads to a few interesting strategies you will see later on.

Teams:

  • AllLean: PHP
  • Charlie Firpo: Java
  • Cppoker: C++
  • Grandious: Groovy

Each point in the chart represent a “sit and go”. The point average is deducted to clearly see the differences between the teams. In real life all the programs went up to above 400 points.

Beginning Phase

After seeing the charts starting we realized we have to do something quickly not to loose too many points in the beginning. We posted a basic player and so until 10:47 we took the lead. Basically all other clients were just setting up their coding environment and we had this half an hour to our advantage.

First fight

The Java team “Charlie Firpo” realized, that these minutes meant 30 points already, so they pushed out a simple player. This player was doing “all (money) in” all the time, no matter the cards. Like a blind player, betting all his fortune on the game, even without seeing his cards. Interestingly this tactic was winning, because if all other players just bet a certain amount and then fold, the bluff just wins the game. And they won big time, especially since we pushed in a buggy player. Our player was frozen until around 10:45, they took the lead around 11:05 and were most of the time first until 12:05. We realized our mistake around 11:10 and quickly pushed in a version to simply fold all the time. This player could never win, but it became the second from 11:40 till about 12:12 all the time. Second place means three points, what is much better than loosing all the time and having zero points.

Other teams rise

Finally the Grandious team with Groovy language set up their environment and started to play actively. They had an excellent series from 12:15 till 13:45. Then they saw 2-3 lost games and pushed in something. This new version couldn’t really compete against the other players and they lost quite many games until 14:30.

Social Engineering

Seeing Charlie Firpo getting almost always a second place I figured they do an always folding always second place tactic. Cppoker had quite bad performance at the beginning, so I’ve even tried some social engineering: So I went to the Cppoker team and I explained, that for both teams AllLean and Cppoker would be beneficial, if Cppoker would always fold. Then they would be second half the time with an average of 1.5 points, what was better than their performance until 12:00. And for AllLean it would be good to decrease the folding points of Charlie Firpo from a single folding player three points to a second folding player 1.5. Of course this move is debatable, because to advance among players one needs an algorithm with more two points on average. (Sorry Csaba, if I influenced your team in a wrong direction. I thought you were below one point average. Moreover I admit, that first of all I wanted AllLean to advance against Charlie Firpo.)

This is an important takeaway for me: If I advise anything to any other team, especially if they are not doing so good, it can cause some personal emotions and mistrust. And good performing teams don’t need my advice anyway, so I should better keep them to myself in this case 🙂

Hardball

At around half past two all language envirnoments were working well, basic algorithms were in place. The real fighting started. Charlie Firpo saw a decline, what was not really a decline, but simply other players getting active. They invented a new routine in a rush, but then a real decilne for them started. Grandious seemlingly choose an always folding algorithm first and then they started to implement new better and better algorithms. Cppoker was also getting better and better. I would not be surprised if they would have won the game, had it been started only around 14:00.

Final struggle

Around 15:30 push came to shove, teams just wanted to win, as many points as possible. Any “always folding” or “always all in” strategies caused a long term decline. For a short time starting around 15:40 we – the AllLean PHP team – tried an always folding tactic. We saw, that all other teams became very agressive and thus a sure three points were above the possible five ( 5/3 = 1.67 I would count, if we would have the same winning strategies). But we knew, that we cannot win with always fold, because another always folding player immediately puts our robot to an 1.5 average, what is way below the remaining player average: 5/2 = 2.5. So we implemented a pointing system with a special shortcut: If we didn’t have pairs or cards above seven average, we fold immediately.

Finals

Interestingly team Grandious with the Groovy language caught the wave and in this final half an hour their performance was better than any other team, but they didn’t have enough time left to outperform us.


I wanted to change our basic tactic, but my team members just hushed me down and said that they would rather go have coffee for half an hour, so we cannot make any rushed and buggy changes :). We brought in around 2.1 points on average, what was enough to first catch and then overtake Charlie Firpo. They had serious technical problems around 15:30, what lasted for half an hour.

Conclusions

Winning is clearly not rewarded by the organizers, because it is not winning what really matters. It is the effective learning what matters, what you will do differently afterwards. Answers to these questions became imprinted to our minds, we cannot forget anymore:

  • What does continuous deployment really mean?
  • How can one devise and use a simple algorithm until one comes up with something better?
  • What is the attitude necessary to survive and thrive in a constantly changing environment?

So I personally thank Rafael Ördög (Devill) for taking his time to realize this great competition. I honestly wish this becomes a great championship with international gatherings.

Also thanks for the office and lunch for Morgan Stanley.

For more info on Lean Poker, check leanpoker.org

View from the office terrace.

总结 / Summary in Chinese

我们组织了一次扑克电脑挑战。在此我们分小组,每小组用不同的程序设计语言,如:C++、PHP、Java、Groovy。我们设计了可互相玩儿扑克的程序。
我们的小组,”AllLean”用PHP语言赢了,但是重要的不是赢输,而更重要的是经验“持续部署”(continuous deployment),各两分钟,以及对其他小组进行的策略。比如,我们经验了“上市时间”的重要性。
我感谢Raffael Ördög为了准备和组织这次活动,并感谢摩根士丹利为我们提供办公室。

Short Summary in English

(if you want to study technical language in Chinese)

We organized a poker computer program challenge. Here we were divided into teams and each team used a different programming language:C++, PHP, Java and Groovy. We constructed programs, that could play poker against each other.
Our team, “AllLean” with the PHP language won, but not winning is what matters. More important is the experience with continuous deployment (each two minutes) and employing strategies against other teams. We experienced how important for example “time to market” can be.
I thank Raffael Ördög for preparing and organizing this event and for Morgan Stanley for the office space.