Skip to content


Tag: Matt

Over the years, I’ve offered an extra bed or at least a couch to a number of online friends who have stopped by Taipei or wherever I happened to be living. I’m not sure my grandmother would approve, but I think the conventional wisdom about is wrong on this topic. The risks are mostly over-stated and the benefits are often overlooked. People are mostly good and on the whole and as far as I can tell, helping travelers out is a net gain for both the traveler and the host.

The online friends I’ve invited over fit into three groups. Some, such as Brian, keep mostly to themselves, spend a lot of time on their laptops blogging or doing whatever it is they do and don’t really impact my routine one way or the other. Without exception, they’re always good for an interesting conversation or two. Hosting them is definitely a net positive. The second group are people like Darin. They make plans to come and I offer them a place to stay, but then they end up canceling the trip. Nothing is lost and nothing is gained… except maybe an increased chance of them offering me a place to stay when I visit the country where they live. The third group is those like my friend Wayne who end up becoming great friends and hanging out with me regularly for months or even years. That’s not only worth it, but it’s enough to upset the risk of a really bad guest (which I haven’t experienced yet).

One other thing that has been absolutely wonderful is that an unusually large number of people have let me crash at their places. John, when I visited Shanghai, PR when moving in Taipei, Matt before I left Colorado and now Ben in Kunming. I can’t really draw any connection between me having other guests at my place and them inviting me to stay at theirs, but if I did believe in earthly karma this experience would certainly reinforce that belief.

I went back to Colorado to see my friends and family this summer. It was a great vacation and it really gave me a lot of things to thing about. So much in fact, that every time I’ve started going over my diary I’ve gotten lost in thoughts before transferring any of them online. This has to go up today, though.

My dear friend and former roommate Matt Ball is running up a mountain. This is the same guy who helped get me interested in both poker computer science over a decade ago, the same guy who used to wake me up at 5:30 am and ask if I felt like riding over to the pool for a swim before work or if I was a wuss, the guy who used to do easy 15 mile runs with me on the weekends and split a 3 pound Beau Jo’s pizza with me afterwords.

He ran a marathon a few years back, but this task is much, much more ambitious. This run is up a mountain called Pike’s Peak, one of Colorado’s 50-some “fourteeners”. For those not used to measuring mountains in feet, that’s an elevation of about 4,300 meters. I’m not sure exactly how much the altitude gain is during the run, but it’s a lot.

Pike's Peak from Colorado Springs, by David Shankbone

Be safe buddy and enjoy the clean air!

Imagine my delight when I heard that there would be a Poker Tournament at Dartmouth! I really used to enjoy playing poker back in the day, before it was cool. For a while, during my senior year at UCBoulder, my friend Matt and I were both writing software to study Texas Hold’em and regularly going to the casinos in the few mountain towns in Colorado were they’re legal. It was a lot of fun.

After graduating and moving abroad, though, I just didn’t have any chances to play for several years. In fact, the only game I can remember playing in my entire time in Taiwan was the “penny” game I set up a couple of weeks ago. It wasn’t a huge priority to find a poker game or anything, but I was definitely stoked about hearing of a tournament.

The Setup

It was a zero dollar buy in, with only gift certificates as prizes– a fun tournament. Potato chips and random junk food were at every table. After checking with Sonia to make sure I was allowed to play, I eagerly headed over to the basement room in which it was being held. I showed up about 10 minutes early, and sat down at the one table that already had a few guys seated around it. They seemed oddly tense for being at a fun game, but they were all pretty friendly. Soon, more and more people came streaming into the room, until eventually about dozen tables were full, with eight to ten people seated at each.

It was a no-limit Hold ’em tournament. We started with a “dollar” (i.e. white chip) small blind, and a four dollar big blind. According to the organizers, the blind would double every 20 minutes, so we couldn’t dawdle too much. That wasn’t a problem at my table.

The First Table

On the very first hand, four people at my table went all-in. I couldn’t believe it. Either they had all gotten some remarkably lucky hands, or I was at a table full of maniacs. I sat the madness out, knowing I wasn’t throwing my chips away on a sub-par hand, but also knowing that nearly half my table’s chips would soon be in the hands of whoever won that hand. And so they were. After he had all the chips, he just leaned on the rest of us, threatening to put someone all-in on nearly every hand, bullying us out of the blind bids.

After the deal had gone around four more times, I was down to two-thirds of my initial number of chips. I was starting to think it would be worth it to bluff, which would have been credible at that point, when I got a great pair of hole-cards, AQ suited. I bet 10, and called a raise of 30 to see the flop. There was an ace, a jack and a three. With the high pair, I bet again, and one of my opponents called, and the one with all the money put me all-in. In the end my pair of aces beat his pair of jacks, my pile of chips was about the size of his, and the other guy was knocked out of the game. At this point, only three of us were left at my table. Not even a single person from any of the other tables in the room had been eliminated yet.

In the next hand, I had garbage, and the opponent without many chips went all in and lost. Then the game organizers announced to us that the blinds would be doubled to 2 and 4. Seeing as my entire table’s chips were divided between me and one other guy, this struck me as funny, but we kept going. Within 5 more hands, I had about 80% of the chips. Then Sonia and her friend showed up and said hi to me. I think the were a little surprised to my table mostly empty, and most of the chips in front of me.

The Second Table

About that time, the organizers noticed we were down to two people, and a couple of the other tables had eliminated players, so they sent us to those tables to take their places! It wasn’t even fair. I showed up at the new with about the vast majority of the entire table I’d come from. They were weaker players than my previous opponents, too. They were betting on inside draws. Some of them were trying to bluff on every other hand. They weren’t raising when they had winners. It took me 15 minutes to wipe out the entire table. By that time, more people were getting eliminate around the room, and people were getting consolidated to fewer and fewer tables.

The Final Table

To make a long story short, the competition was weak. Extremely weak. I knocked out a dozen more people and moved on to the final table with dozens of times more chips than we’d each started with. Unfortunately, that wasn’t quite the right impression to make. As soon as I sat down, one guy at the table said, “Woah, this guy must be a pro!”

I said I wasn’t a pro. Nobody believed me. Somehow, they figured that a professional gambler would come to their campus for their zero dollar buy in poker gave, load up on free soda and Doritos, and try to win a small gift certificate instead of going to a casino, getting comped steaks and cocktails, and winning real money.

“What year are you?” asked another.

I answered honestly that I wasn’t a student at all, and that I was playing in place of my girlfriend I was vising. That didn’t go over very well.

“This is a student tournament!”

“You can’t just invade it and take advantage of it!”

They were really competitive about this game. Admittedly, I’ve never been to a tournament before, and some of them might not have realized that this one was open to non-students. Still, I’ve been in casino games with hundreds of dollars on the table and I’ve never seen people get so worked up like this before. It was really eye-opening. If Sonia had been there, I’m sure she could have smoothed things over, especially being a UGA. As it was, though, it just wasn’t worth ticking everyone off to win. I couldn’t really walk away, either. They’d still feel like I’d wreaked the game.

So, I started doing randomized bluffs, but far too loosely. I continued to bet and play good hands, but I also played every single hand with a diamond of 7 or less. Amazingly, people became more and more talkative as my pile of chips dwindled, and soon they were asking me all about living in Taiwan, and what I thought of their school. Within 15 minutes, I had eliminated myself in what I hope looked like a completely natural performance. Then, without the gift certificate, but in a great mood, I headed over to the animation lab to find Sonia, Adelle and Dawn.

Matt has republished some of our best iDrone posts:

Writing an accumulator generating function in Ruby (Mark Wilbur)
Thoughts on the Subset Sum Problem (Matt Ball)
On Google’s Evilness (John Pasden)
The Perfect Programming Language (Matt Ball)

We had some serious geekery going there while it lasted.

What a painful day it was at work yesterday. On Thursday night, I got an email from Martin, saying that there was a bread-maker with my name on it at his place. Since he was leaving for Japan the next day, I headed over right away.

The apartment looked like some sort of disaster zone. I really can’t command adequate words to explain the place. Garbage was everywhere, and though the Tealit Vultures had cleaned out all of the big things, there must have been hundreds of books, pieces of clothing and other things that couldn’t be sold. After a single glance it was clear- Martin was screwed.

Not wanting to see his landlady (who rivals my old landlady) keep his entire deposit. I helped him out. We packed stuff into bags, we dragged what seemed like 40 kilos of clothes to the charity drop off and we hauled crap out of his apartment until daybreak. There were a few adventures of the evening that I don’t really feel should be on the internet, but suffice to say, it was very similar to the experience Matt and I had in the 24 hours up to the time I sold my old house in Colorado. Some things are the same everywhere.

Something about the regular practice of writing articles for my blog has been very enjoyable to me since I started a few months ago. It helps me organize my thoughts. It helps keep my English writing skills from degrading as quickly as they otherwise would, spending years living in Asia. Of course it’s nothing like churning out essays or poetry in college was, but it is still something.

To be honest, I can’t get enough of it! So, I’ve joined up with John P. and Matt to write a tech blog! It’s not fully fleshed out yet, and Matt’s been too busy writing the latest IEEE 1619.1 draft and honing his NCAA basketball gambling similation to post yet. If you’re curious, though, you can check it out at This project doesn’t mean that I’ll stop writing geeky stuff here, but my postings to the “geekery” category may slow down a bit.

I’ve also been working on another blog to help a couple of advanced students keep in contact with me while doing extensive reading on their own. It’s very bare bones, but I’m adding assignments to it at a pretty good clip. That blog is called

Being a personal site, is very fragmented. Many readers who are really interested in foreign languages could care less about what I have to say about programming, and visa versa. Once again, I’ll suggest that readers who are only interested in one specific topic I blog on, such as investing, use feeds to view only what they want to, as I’ve described earlier.

Last night, I went back to Taibei to play chess with my old co-workers. It’s kinda scary, really. They’ve all been playing regularly, Martin’s been reading books on strategy, and I fully expect to get left way behind in terms of ability shortly. Mike W. was there, though and the topic turned to gambling. As many of my friends know, Matt and I got really interested in poker, especially Texas Hold ’em. Matt wrote a program to analyze the strength of various opening hands against different numbers of opponents. I wrote a Perl program to help train myself to group various opening hands in terms of strength based upon where one is sitting. For example, if you’re in a 10 person game, sitting to the dealer’s left and holding an unsuited Ace-Queen, it’s time to fold. If you’re holding the same cards and sitting to the dealers right, you’ll definitely want to pay to stay in and see the flop.

Game Theory

Then game theory and optimal bluffing came up. Sometimes, there are situations in which a consistent strategy will always fail, and yet a somewhat random strategy, or a mixed strategy will prevail. It sounds irrational, but it is true. Mike asked me to explain it, and I wasn’t able to do so very clearly. So, I’ll have another go at it here. First, there are a few important distinctions to make, though.

Optimal Strategies vs. Exploiting Strategies

There are two kinds of strategies used in poker. In optimal strategies, the opponent is assumed to be strong and adaptive. Optimal strategies are evaluated based on how well they would fare against an optimal opponent. Exploiting strategies are designed to exploit a weak opponent as fully as possible. For example, if you play against a timid opponent who never calls, you can win money from him more quickly by bluffing every time (a strategy designed to exploit his weakness) than you could by using an optimal strategy. The bluffing strategy I’m about to describe is an optimal strategy that will work even if opponents know you do it.

An Example in Which Random Betting is Optimal

Imagine that you are playing a poker game in which the first four cards are dealt out face up, and the last card is dealt face down. After each new card is dealt, each player may bet and raise once. In this game, you and your opponent have just been dealt your final cards, there are $40 in the pot and he has bet $10. The maximum bet is $10.

Opponent’s hand:3♣ 3♠ 6♦8♣
Your hand:K♠ J♠Q♦10♥

There are 8 cards on the table. Your last card, which your opponent has not seen, is one of the 44 remaining cards in the deck. Of those remaining cards, any of the Kings, Jacks, Queens or Tens would give you a bigger pair than your opponent’s threes, and any of the Aces or nines would give you a straight. In other words, of the remaining 44 cards, 20 will give you a winning hand and 24 will give you a losing hand. However, you are still in the stronger position if you use an optimal bluffing strategy. Consider these three cases:

You Never Bluff

In 24 cases out of 44, you have the weaker hand and you fold. In the other 20 cases you bet $10. Your opponent, being a strong player, recognized that you do not bluff and never calls your bet. You win the $40 pot in 20 games out of 44. Since half of the money in the pot was yours to begin with, you earn $20×20 = $400. In the 24 games in which you fold, you lose $20×24 = $480. In the long run, if you employ this strategy, you’ll lose $80 every 44 times you play this way.

You Always Bluff

In 20 cases out of 44, you have the stronger hand and bet $10. Your opponent knows you always bluff, so he calls. You win $40 from the pot, plus his $10 from calling. Since $20 of the pot is your money to begin with, you win $30×20 = $600. In the 24 games you lose, you lose your $20 in the pot, plus a $10 bet each time. That’s a $30×24 = $720 loss. In the long run, if you employ this strategy, you’ll lose $120 every 44 times you play this way.

You Use Game Theory to Bluff an Optimal Amount

It is possible to use your opponent’s pot odds to determine how often to bluff. In this case, always bet on the 20 winning cards plus four of the 24 losing cards, and you’ll have the edge. It doesn’t matter how you determine when to bluff, as long as it’s random (at least to your opponent’s perspective). You could say, I’ll bet if I draw a winning card OR a two of any suit. You could ask your friend to give you a random number and then divide it by 24 and only bet on losing cards if the remainder were under 4. Anything random will work. Bet on the 20 winning cards, plus 4 losers. Unless you give tells or your opponent can crack your “randomization” scheme, there is no strategy he can employ that will give him the edge.

Your Opponent Folds When You Bet

You bet on your 20 winners, plus 4 of the losers. Your opponent folds every time, so you win $20 from the pot 24 times for a total of $480. You fold on 20 of the 24 hands in which your last card was a loser, losing $20×20 = $400. In the long run you’ll win $80 every 44 times this situation comes up against an opponent who folds.

Your Opponent Calls You

You bet on your 20 winners, plus 4 of the losers. Your opponent calls each time. On the 20 hands in which you really do have the stronger hand, you win the $20 he put in the pot, plus the $10 call. That’s a total of $30 x $20 = $600. On the four hands in which you bluff and lose, you
lose $30 x 4 = 120. On the 20 hands you fold, you lose $20 x 20 = $400. In the long run, you’ll win $80 every 44 times this situation comes up against an opponent who calls.


Don’t underestimate math geeks! By utilizing game theory, it is possible to construct a mixed strategy that can win in some situations when any consistent strategy would fail.

Notes: I realize that I didn’t address the possibility of the opponent drawing a 3rd three or a 2nd six or eight, each of which would beat a high pair, but not a straight. I’ll leave that as an exercise for the reader. This is a simplified example. For a more realistic one, see the comments below.

The optimal bluff is calculated based on the pot odds your opponent would if you bet. Advantage is maximized when the odds that your bet is a bluff are equal to your opponent’s pot odds.

BattlePanda just hit me with blogging’s equivalent of a chain-letter. I hate this kind of thing, but it would seem rude not to accept, so I’ll do the sensible thing… go along with it and grumble. I’m not really much of a movie guy, though, and I don’t go on many vacations either. Grumble, grumble, whine, whine, grumble.

Four Jobs I’ve Had
1. Fast Food Slave Team Member
2. Home Painting Franchise Manager
3. Bartender
4. Programmer

Four Movies I can watch over and over
1. Dead Poet’s Society
2. The Matrix
3. The Princess Bride
4. Any Zhou Qinshi Movie

Four Places I’ve lived
1. Boulder, Colorado
2. Austin, Texas
3. Xela, Guatemala
4. Jiayi, Taiwan

Four TV shows I love:
1. DS9
2: Babylon 5
3. Highlander
4. Friends

Four highly regarded and recommended TV shows I haven’t seen (much of):
1. Battlestar Galactica
2. That one with the writer of Seinfeld
3. That other new show everyone’s talking about
4. The other one… you know?

Four places I’ve vacationed:
1. Chicago, Il., sort of
2. Vancouver, BC
3. Hualian, Taiwan
4. Home (to see my family and friends)

Four of my favorite dishes:
1. Combo #5 (at any Mexican restaurant)
2. Pad Thai Phet
3. 宮寶雞丁
4. Pizza (Jalepeno and Black Olive)

Four sites I visit daily:

Four places I’d rather be right now:
1. Beijing, China
2. Harbin, China
3. Chengdu, China
4. My grandma’s house in Colorado

Four new bloggers I’m tagging:
1. Matt’s Wiki (that’ll kill this thing for sure)
2. Frequent Sinosplice commenter, Carl
3. Warren
4. Darin

Have you ever tried to write a program that outputs itself when you run it? While I was eating at Wahoo’s Fish Tacos with Mike and Matt a couple of weeks ago, Matt brought up the topic. Being the guy that he is, he whipped out a napkin and proceeded to write an example of a self replicating C program.

I guess it’s been a fairly well-known topic for a while, after being popularized by Ken Thompson’s speech twenty years ago. These self-replicating programs have a special name- they’re called quines. It’s an interesting, and surprisingly difficult task to make a quine, especially in low-level languages like C. I should know, because I had to beat my head against the problem for a while before it came to me.

The interesting thing, though, is it’s not that hard to write a quine in Python. Due to some of the interesting essays by Paul Graham that I’ve been reading, I’ve started learning some Python over the last week. Despite knowing only a very small amount of the language, I was already able to write this quine tonight:

x = ['print "x =", x', 'for m in x: print m']
print "x =", x
for m in x: print m

For anyone that wants to try running that and see that it does indeed output its source, get a Python interpreter and try it out. My code above is not that impressive as quines go. I’m sure that in a powerful language like Python, somebody out there has already written a one-liner. What is impressive is that the language is powerful enough and convenient enough that writing a quine is easily doable for a complete beginner. If I were using FORTRAN, for instance, I’d have to do a fair amount of brushing up before I’d even have a hope. I’ve never been much of a fan of Java. I’ve always been a Perl guy, except for graphics engines (which I did in C). Paul Graham’s on to something with Python, though. It’s surprisingly easy to get up to speed with it, and it’s much more powerful than I expected, too.

Update: This page includes many Python quines, including one-liners and one that’s logically equivalent to mine.

Update 2: Come on all you geeks out there, post your quines as comments here! Matt, you could make one in Javascript, right? I mean… you’re not a wuss, right? Ducky, how about flexing those MATLAB trained mental muscles of yours? Mike W, you said you were getting pretty into PHP. .. post me a quine!

Last night I finally had a chance to meet up with Thomas and Irene. They drove down from Louisville (near Boulder), picked me up and went to eat at Maggiano’s. Surprisingly, Matt and Nicole came all the way down from Boulder to eat with us, too. Thomas and I did most of the talking, but I guess I don’t feel too bad about it. One of Matt’s main motivations in coming was that he was really looking forward to Thomas and I having a knock-down drag-out fight about the relative merits of programming in Java.

Unfortunately we weren’t able to oblige him. As most people who know me know, I’m not much of a fan of Java. For small pieces of code that must be executed many times, such as game 3D engines I use to work on, I like C. For code that must be written very quickly or for most large, complex projects, I advocate more powerful languages such as Perl, Python, or Lisp. I’m also strongly opposed to “all Java” CS programs at various colleges. Pointers and recursion are two of the hardest, but also most important things CS students have to figure out in school. At “all Java” programs, they can graduate without really grokking either one.

Matt had heard that Thomas been trying to get his group at to switch from using C++ to Java. Considering what he’d heard, I guess it was reasonable to expect an argument between us. Here was Thomas’s line of reasoning though:

  1. Most of his old co-workers don’t understand pointers or recursion.
  2. Letting them code their own garbage collection is a disaster.
  3. Java’s pretty good for cross-platform GUIs that aren’t web-based.
  4. Java just might save bad programmers from themselves.

DSC00002I couldn’t really disagree with any of that, so the conversation went on to other topics, such as Matt’s mathematical model for NCAA basketball tournaments that have led him to win 2 consecutive office pools (and soon a third), investment ideas, Thomas’s new company he started, etc… All in all it was pretty interesting. I don’t know too many other people who have such a range of technical interests. Heck, Thomas literally built a spaceship in his garage for the X-prize competition. Naturally, enough the conversation turned to the Russian’s plans for mining He3, which will be the topic of my next post…