Archive for the ‘Observations’ Category

Life Lessons From Poker

Monday, October 12th, 2009

I first started playing Texas Hold ‘Em poker at Harvey Mudd College, in Claremont, California, while working for the NSF. I have many fond memories of staying up until 3:00 AM playing poker, drinking, and just having fun being a young person with few responsibilities in the world.   When I moved to Chapel Hill, North Carolina, in May 2007, I quickly found a poker game and that’s how I’ve made most of my friends here.  I’m still more or less a beginner;  by my estimate I’ve played maybe 10,000 hands of poker.   I’ve learned a decent amount about the game, and I think a lot of the lessons I’ve learned from playing poker are transferable to life in general. I thought I’d share those lessons for those interested.

  • In the long run, ‘lucky’ players make their own luck

    This lesson is by far the most important lesson I’ve learned, both in Poker and Life in general.   Over the course of a single night a player may get incredibly lucky or incredibly unlucky. In the long run, though, players who consistently make intelligent moves create their own luck by increasing the probability that they will be in situations to make money.  The key to understanding this lesson is to repeat the phrase ‘in the long run’ over and over. Players can go on months-long ‘bad’ streaks, but good players will eventually make more money than bad players.  Life works the same way.  In my experience, I’ve had streaks of terrible luck at some times, and I’ve had runs of awesome luck at other times.  I believe the reason I’ve done well  in life (at least thus far) is largely the fact that I try to shrug off the bad things that happen to me as mere bad luck, and I try to capitalize on the good things that happen.

    Consider this Example:  At the end of College, I planned on getting a Ph.D. in Computer Science.  At a time when I was living on on about a thousand dollars of income each month, I spent over a thousand dollars applying to some of the best schools in the country: Stanford, Berkeley, MIT, Carnegie Mellon, Illinois, and Georgia Tech. I chose two safety schools: UC San Diego, and Univeristy of North Carolina. I was rejected outright from every program except UCSD (who put me on a wait list and then rejected me) and UNC.   It  definitely hurt to be rejected from so many places, but I realized that coming from a practically unheard of liberal arts college in Cincinnati, and lacking any real research experience, it would be a crapshoot for any school to admit me.  You could definitely say that I was ‘unlucky’ because I only got into my safety school.  I could have taken the job offer I had in Cincinnati, but I knew my career opportunities would be better if I went to grad school, even if it wasn’t MIT.  I took what I saw as one of the worst possible outcomes of the grad school application process and turned it into an opportunity to improve my career.  Blue Capital Group, my current employer, just happened to be located in Chapel Hill, and they just happened to email my algorithms professor looking for new recruits at a time when I was looking for a job.  I took what I saw as a chance for some good luck, and capitalized on it. I now work at a  job I absolutely love, at a time when many people are struggling to find any job at all.  I could go on and on, because my life has been full of both good luck and bad, and the main lesson I’ve learned can be summed up as follows:

    • Recognize and accept that sometimes you’ll have good luck, and sometimes you’ll have bad luck.
      Chances are, if you’re reading this, you’ve had way more good luck than bad because you have access to the internet, the ability to read,  and knowledge of someone as awesome as myself :-p
    • When you’re unlucky, try to way to turn your bad luck into an opportunity. If that fails, shrug it off as bad luck.
    • When you’re lucky, realize that you’ve been granted an opportunity and do everything you can to take advantage of it.
  • Know when to hold and when to fold

    That pair of red aces you were dealt just doesn’t look so good when there are four spades showing on the board, even if one of them is the Ace. Sometimes you have something really good going in life, but you have to let it go because it’s starting to fail. If you hold on to things that were good and have gone bad, you’ll be doing yourself a huge disservice.

    This lesson is especially true in romantic relationships – the longer you hold on to a doomed relationship, the more pain you’re going to cause the both of you, and the harder the breakup will be. Once you realize a relationship isn’t going to work, you need to inform your partner and leave that relationship – it’s the best thing for both parties involved.  On the flip side, when you have the nuts (poker lingo for the best possible hand), you have to do whatever you can to increase the pot size, without scaring other players out by revealing what you’ve got.  When you meet someone that you connect with on every level, someone you love to spend time with, someone who understands you better than you understand yourself, you have to realize what you’ve got and hang on to it.

  • Have confidence in yourself, but not too much

    Having too little confidence in your hand will hurt you because you’ll get pushed around by bigger stacks. Having too much confidence will hurt you becuase you’ll call bets you shouldn’t. There’s a fine line you have to walk with confidence, and the ability to determine when you’re being confident enough is an important skill to hone.

    If you think you’re the smartest man whoever lived (as I once did), that confidence will help you out at times because it’ll allow you to tackle problems that might scare away mere mortals.  It can cost you, though, if you overextend yourself or try something that is beyond your level.  My confidence was shattered when I reached grad school and realized there were people who could think circles around me; people who have thought up and then forgotten things I’ll never begin to understand.  I went from having too much confidence in myself to having too little. I thought I couldn’t accomplish anything and that I’d never amount to much more than an unhappy burnt-out developer.  As I suffered through grad school and started to figure out what was going on, my confidence grew a little bit. I got the nerve to apply for an internship at Microsoft, and being hired for that internship gave me a huge boost in confidence. I started doing better in everything I did.

  • It’s all about discipline

    I know I’m bad at poker, at least compared to my friends. My main problem is that when I’m not getting cards, I don’t find the game very fun, so I do things that I know I shouldn’t.  I know not to play trash hands like Ace-Seven off suit, but I get bored and put money into the pot when I shouldn’t because I’d rather have fun than make money. I don’t have a problem doing this in low limit games, because the amount of money involved in doing so is usually very minimal, i.e. 30 cents.  In higher stakes games, this sort of behavior can cost you a lot of money. I stay away from high stakes games because I know that I don’t have enough discipline to play real solid poker. All the theory in the world won’t help you if you don’t follow sound logic and fold when there’s four to a straight on the board, you’ve got two pair, and your opponent has pushed you all in.

    Life in general works on the same principle. You can read all the diet books you want, and you can understand body chemistry all day long, but if you don’t go to the gym and lift regularly, you’re never going to be able to reach your fitness goals.  You can dream of being a millionaire all day long, but if you don’t work hard, save your money, invest wisely and avoid splurging on things you don’t need, you’ll never make it.  Going to the gym, working hard and saving money all require discipline.

I’ll end this already too-long post with a caveat: Not every lesson learned at the poker table applies to real life. Probably the most important exception is the fact that  poker is a Zero-Sum game. That means every player who succeeds does so to another player’s detriment. Real life is most certainly not zero sum – there are plenty of ways that two people can interact with each other such that both people benefit. This sort of mutually beneficial interaction is the cornerstone of civilization and, I would argue, the basis for all just governments.  But that’s a post for another day.

A Random Fact About Yourself

Monday, January 26th, 2009

I was tagged in a note on facebook, titled ‘25 random facts about myself’. You’re supposed to write “25 random things, facts, habits, or goals about you”, and tag 25 people, as well as the author of the note.  What does it mean to write a random fact about yourself?

Let’s figure out how many facts I could choose from. To simplify things,  let’s suppose my life occurs in one-second ‘frames’, and that my life is constant for the duration of that frame. In other words, lets assume time is divided into fixed-length quanta. As of the time of this posting, I am a little over 23.5 years old. That’s approximately 700 million seconds.   If a ’story’ about myself is a sequence of quanta, there are 2700 = 5.3 x 10210 possible stories about myself I could tell. For comparison, there are about calculated to be 1080 atoms in the universe. Even if I increase the size of the quantum to an hour, and limit stories to be descriptions of no more than 20 quanta, we have 7x1078 possible stories. That’s still a lot of stories.

Interestingly enough, if I used python’s random number generator,  the Mersenne Twister algorithm, I could actually implement a program to randomly select one of those stories, because it has a period of  219937-1. I thought about generating a truly random story, using a sweet bit of python code, but it probably wouldn’t be too interesting. It’d be really difficult to write anything about what I was doing at 4:00 on March 3, 1994, other than ‘I was 8 years old.’

On GPS Navigation Unit Mapping Algorithms

Wednesday, January 21st, 2009

I currently live in Chapel Hill, North Carolina. I grew up, however,  in Cincinnati, Ohio and a couple of times a year I make the drive back there.  The best route takes me through West Virginia on I-77 to Charleston, but after that it’s really up in the air as to what the best way to get to Cincinnati is. I’ve experimented with a number of routes, and after consulting my GPS unit, Google Maps, and AAA, I think I’ve come up with the best possible route.  For those interested, it is OH-32 to US-35 to US-34 to I-64 to I-77 to I-74 to US-52 to US-421 to I-40 to NC-54.

Why was I able to find a better route than my GPS unit, into which probably went thousands of man-hours of labor? My guess is that the algorithm used by the GPS unit is not theoretically optimal.  The reason for this is simple: the country is  huge.   There are about 6 million miles of paved highway in the US. Assume we have 10 intersections for every paved mile of road (a very conservation assumption): then we have 60 million intersections. A graph with 60 million vertices has at least 60 million edges, but probably closer to 120 million if it’s connected at all (60 million edges would just be a straight line, which is obviously wrong.)  A very good shortest path algorithm running on a graph with E edges and V vertices takes runs in time roughly proportional to E * log V.  Plugging in 120 million for E and 60 million for V, we get a number of computational operations on the order of 2 billion.
I have a Garmin c340, but I couldn’t find data on its microprocessor. Therefore well assume we are using a Tom-Tom 720, which has a 400 Mhz microprocessor inside. This means it undergoes one clock tick approximately (1 MHz = 1048576 Hz) 400 million times a second.  Each operation probably takes on the order of 100 machine instructions. If we assume perfect pipelining in the microprocessor and 0 cache misses ever,  we get 1 instruction per tick. That’s 200 billion instructions, at 400 Million instructions per second, for 500 seconds processing time on our GPS unit . 8 minutes would be a long time to wait for a route, and that’s with a number of conservative assumptions.  Once you take memory latency into effect, you’re probably looking at 16-20 minutes to find a route.

Your little GPS unit inside your probably employs a heuristic that favors taking interstates over back roads, among others.  It almost definitely also uses the fact that the graph of the roads embedded on the surface of a sphere.  It sure would be interesting to figure out what kind of algorithms they use inside that little thing.  Google Maps is an entirely different story- they have much faster processors and can probably find paths in parallel. What sort of parallel algorithms for finding shortest paths exist? Could you cache frequently used route portions? How would that work ? Just something to think about.

On Martin Luther King Jr.

Monday, January 19th, 2009

Today is a Market Holiday, so I don’t have work. For those keeping score at home, I started working at a financial company this fall. It’s called Blue Capital, and it’s a really amazing place to work. They routinely face all kinds of interesting computer science problems that require solutions which are both elegant in theory and efficient in practice. I’m really happy there.

Anyways, back to the task at hand.  Today is Martin Luther King Jr. Day. MLK Jr. was a great civil rights leader who opened the eyes of his fellow countrymen to the injustices suffered by black Americans, particularly in the south.  Was he a great man? I think, undeniably the answer to this question is ‘yes’. However, there is a more interesting question – was he a good man? The answer to that question, I think, is ‘ probably not’.

Unfortunately, I don’t have sources for a lot of this information, which is why I prefaced my answer with ‘probably.’    Firstly, he is alleged by numerous sources to have cheated on his wife. The only real web sources I could find for this point (that weren’t from hate sites) were about.com, and the straight dope, two sites I believe to be (relatively) bias free, at least when it comes to overt racism. A lot of the allegations come from illegal FBI wiretapping of King, and can’t really be trusted, but some come from King’s lifelong friend Ralph Abernathy.

Secondly, King plagiarized significant portions of his doctoral thesis, academic papers, and speeches.

Why does any of this matter? What’s the point of dragging a revered historical figure through the mud?  My reasoning is that I think there’s an important distinction to be made between good men and great men. Great men are nice and well and all; they do change the world significantly, but great men also tend to suffer from narcissism and selfishness. Consider Albert Einstein – brilliant man who undeniably advanced the state of science, but also a jerk who cheated on his wife.

Why the fixation on adultery? Am I some kind of right-wing christian conservative? No, not hardly. A marriage is not just a simple contract between two people made for financial considerations – it’s a lifelong commitment with profound implications for children.  Cheating on your marriage partner is probably one of the worst things you can do to them. It’s an incredibly self-centered thing to do. Not only does it cause significant emotional harm to your spouse, it causes irreparable harm to any children in the marriage.  It is well documented that children do far better in stable family structures with two parents around.  (Personally I don’t think it matters what gender the parents are, as long as they love and are committed to each other, but that’s an entirely different argument.)   A little over two thirds of all black children born in America today are born to unwed mothers.  Those children do not have the same chance at success as children born into stable, two-parent families centered around a committed relationship between two adults. Any man who would cheat on his wife, betraying that bond of trust and hurting the future of his children, is not a good role model.

Is there institutionalized racism in the world today? Absolutely. Did Martin Luther King Junior do a lot of work to fight this racism?  Of course; That’s why he was a great man. However, there’s a solid difference between great men and good men. Great men do extraordinary things with their lives.  They’re good for the world. What we need, however, more than great men, is good men, men who do ordinary things extraordinarily well. Men who get up every morning to go to work, who pay their taxes and give back to their communities in the small ways that they can, and who set excellent examples for their children. Given the choice between being a great man with a flawed personal life, and a good man who never accomplishes anything ‘of note’ in the world at large, I will choose to be a good man any time. I should hope you feel the same way.

Credo

Thursday, August 14th, 2008

I believe in myself.  I believe that the mind has incredible power over the body, and that eating breakfast every day is good for you.  I believe in small miracles. I believe in the power of free markets to improve the human condition. I believe that human history is a story of progress, and that the future will be better than the past. I believe that family is the single most important thing there is on this planet. I believe in a thing called love, but I don’t really know what it is or how it works. I believe that peace will  come to the world, albeit gradually.  I believe low pocket pairs are rarely worth the trouble they can cause you.  I believe that strawberry jelly is superior to grape jelly, especially vis a vis peanut butter and jelly sandwiches. I believe a first kiss should be as romantic as possible. I believe in following big dreams, no matter how likely you are to obtain them.  I believe in opening the door for others. I believe that not all cultures are ‘equal’ in any real sense, and that the values a culture holds effect that culture’s economies and social freedoms.  I believe in taking responsibility for my actions, and ensuring that others do the same. I believe a man should take his fate into his own hands, whether or not he has the ability to do so. I believe that life is 10% what you’ve been given, and 90% what you make of what you’ve been given.  I believe in preventative maintenance.  I do believe Jones Soda to be absolutely delicious.  I believe in making small differences, especially when they don’t seem to matter at all.  I believe that, somehow, we are all one. I believe that sometimes, the only solution to a problem is violence. I believe that game theory is one of the most underutilized mathematical constructs. I believe that P will eventually be found to encompass all of NP, but that NP-Complete problems will still be effectively intractable. I believe python to be an amazingly useful language. I believe that computer programs are beautiful in of themselves, regardless of what they do.  I believe that the scientific method has been phenomenally successful  in helping us divine the nature of our world. I believe organized religions like modern Christianity have spread good works all over the world. I believe Islam is fundamentally incompatible with a Free, Democratic society. I believe in challenging common wisdom: Can you really boil a frog to death by gradually increasing the heat? I sincerely doubt it. I believe that saying ‘please’ and ‘thank you’ make a small difference in someone’s day. I believe that small differences can make a big difference. I believe that voting is irrational. I believe it’s OK to be irrational every now and them.  I believe the world was created by a phenomenally intelligent entity, as an act of supreme love.  And in the end, I believe that everything will work itself out.

Zen and the Art of Guitar Maintenance

Thursday, August 16th, 2007

I’ve been reading the book Zen and the Art of Motorcycle Maintenance, for a variety of reasons. One of the ideas I’ve taken out of the book is that idea that, when you’re working on an object, like a motorcycle, or a guitar, your attitude makes all the difference. I bought a new electric guitar back in December. This guitar has what’s called a floating bridge. Normally, the strings of the guitar are anchored at one end by the tuning pegs, and at the other end by the bridge, which is attached to the body of the guitar. A floating bridge isn’t screwed into the solid body of the guitar; it floats on a hinge, held in place by several springs in the back of the guitar. These springs contribute to the resonant frequencies of the guitar. They also allow you to use a whammy bar to perform all kinds of crazy tricks. I can’t get enough of that thing.

What I didn’t know when I purchased the guitar is that a floating bridge makes tuning the guitar much more difficult. Normally, you tune a guitar by increasing tension on the strings by turning the tuning pegs. Each string can be tuned individually to the perfect pitch. This isn’t possible with a floating bridge. Increasing tension on one string pulls the bridge closer to the head of the guitar, slightly lowering the tension on all of the other strings. This means that when you tune one string up, all of the other strings drop slightly in pitch. Conversely, tuning a string down slightly increases the pitch on all of the other strings. Tuning becomes quite the juggling act.

At first, I became really frustrated trying to tune this thing. It was taking way longer than normal, and I felt like I wasn’t getting anywhere. After breaking a new string, I figured it was time to call it a night. This morning, I bought a new set of strings and tried again, but this time, I set about my work feeling more relaxed and almost enjoying the slow, steady process. It still took a long time, but when everything was all tuned up and all the notes were right on pitch, it felt great.

I couldn’t find a decent set of instructions on how to tune a guitar with a floating bridge online, so I figured I’d explain how i did it here, for interested readers. The biggest thing to keep in mind is that drastically changing the tuning on one string is a bad idea; the increased tension on the bridge will significantly lower the pitch on all of the other strings, and if you keep trying to adjust them individually, you’ll gradually raise the bridge until you snap one of your strings.

I made myself a little graphical image of where each string’s pitch was relaltive to what it was supposed to be. I then adjusted the string whose pitch was the worst, but only slightly – by at most a semitone. I then updated the image so that I could see where all of the strings’ pitches were, relative to where they were supposed to be. I kept moving back and forth between different strings, each time selecting the string whose pitch was farthest from what it was supposed to be, and adjusting it slightly towards the goal. Once I was very close, and all of the strings were within a a half semitone of where they’re supposed to be, I tuned the top strings up above their target frequency. That way, when I tuned the lower strings up to correct note, the top strings gradually dropped in pitch. As I got  closer and closer to getting the guitar in tune, I made smaller and smaller adjustments. It took a long time, but it worked, and you can’t argue with the end result.

Two Thoughts

Tuesday, May 29th, 2007

The first is rather mundane: I get the impression that ‘turning 18′ used to be a big right of passage that marked one as having become an adult. I feel like the ‘real’ right of passage is now college graduation. I really feel like an adult now that I’m supporting myself entirely on my own in a new state.

The second is a bit more profound: Many problems that people are trying to solve have solutions that tend towards simulations of the entire world. More on this one later. Maybe.

On The Speed of Light and Video Games

Wednesday, April 18th, 2007

When you’re making a computer game with interactive 3D graphics, you need to compute lighting if you want your game to look remotely realistic.  The methods for calculating light on a surface can be either quite simple or very complex.  Simple algorithms act as if light passes through all surfaces after illuminating them, while more complicated algorithms allow light to cast shadows. The ‘best’ form of commonly used lighting is raytracing, which, as the name implies, traces rays from a light source to their destintation. (Actually, raytracing algorithms start from a viewpoint and trace outwards, but that’s not really important.) Raytracing allows for the most realistic shadowing, but it’s the most computationally expensive.

The actual physics behind light aren’t all that complicated, as long as you’re only concerned with how bright objects look and you don’t care about what happens when light goes through tiny holes or passes through irregular media. (Answer: weird stuff.)   The reason programmers put a lot of work into lighting algorithms is that computing the effects of light on a scene can take a lot of time. Real-time lighting algorithms generally rely on tricks that allow programmers to ‘get away’ with not actually computing everything properly.

In my Philosophy of Time course, we recently discussed relativity and its implications as to the meaning of time. While sitting in class yesterday, I remembered an idea that I first had while taking modern physics several years ago.  All computer lighting algorithms of which I am aware treat the speed of light as infinite.  It’s not a bad approximation because from the perspective of your typical human being, it might as well.  Does playing an upperbound on the speed of light allow you to ‘get away’ with anything computationally?

I’m pretty sure the answer is yes.  The speed of light is also theorized to be the speed at which forces are transmitted. In other words, if the sun were to ‘dissappear’ right now, we wouldn’t see the sun dissappear until about 8 minutes after it happened.  The same is true of the sun’s gravitational pull – the earth would continue to move in a circular orbit until about 8 minutes after the sun explodes.

If you had a giant computer simulating the interaction between the earth and the sun, the interaction could be parellelized quite nicely, because any change at the sun won’t be able to immediately effect anything happening on the earth. If the force of gravity were transmitted instantaneously, however, as soon as the sun exploded you’d have to recalculate earth’s orbit.

I want to do more thinking on this subject, and lorenz contraction / expansion (the tendency of objects to change drastically in size as they approach the speed of light) and how it could possibly be used to speed up a computer simulation. If it turns out that lorenz contraction does allow you to compute things faster, it would be more evidence for me that the world is, in fact, a computer simulation.

On Boredom

Tuesday, April 17th, 2007

I’m working on a Lego Robot, using a Handyboard, for my AI class. It’s a lot of fun. My brothers had told me about the robot project they worked on their first year at OSU, but I had no idea how much fun it was. The current assignment is to get the robot to drive around on top of a table, looking for a light source, and avoiding falling off of the edge. In order to avoid having the robot get stuck in a corner, I implemented what can best be described as ‘boredom.’ Every time the robot decides to perform an action, if it’s a ‘boring’ action, the robot’s boredom counter is incremented. Other actions are ‘exciting’, causing the robot to decrement its boredom counter. The counter itself gradually ticks down over time. If it ever gets too high, the robot just stops whatever it was doing and does a complete about face, hoping to find something more exciting to do. Without the ‘boredom’ mechanism, the robot can get stuck in some kind of rut.

I had the idea several years ago that perhaps ‘boredom’ was essential to our survival as a species. Whenever I get bored, I go look for something to do. Sometimes, that leads me to something productive. If we human beings didn’t get bored, we might become content just to have enough resources to get by. My guess is that lots of important ideas were discovered by people who could easily afford to amuse themselves doing whatever, but would just get terribly bored.

My whole life has been a struggle to avoid being bored. I get bored very easily and don’t deal with it well. It’s interesting that a feeling that causes me such frustration could be essential to the survival of the species. I suppose that wouldn’t be the first time, though…

I gave a presentation on my comptuer science research today, and this crazy old guy came up and asked what this research was going to do to solve the humanitarian problems in the world. I told him that wasn’t the focus of my research, and we got into an argument about whether or not the Humanities were infinitely superior to the Sciences.  That’s a topic for another post, however.

Seriously, Now

Saturday, April 14th, 2007

What genius came up with the idea of selling popcorn in movie theaters? It’s probably the noisest snack you could eat.