Monday, November 2, 2009

Badass

I love the internet! It's such an amazing storehouse of interesting information, much of which is even true. A while ago I stumbled on the website www.badassoftheweek.com. Every week the site features the linguistically embellished biography of some person who lived a legendary life. By and large they are factually correct (in the case of real badasses) or canonically correct (in the case of fictitious ones).

A smattering of the many biographies:
For some reason this site really tickles my fancy. It's the intersection of two things I both love and appreciate: learning and kicking ass. Take this excerpt from the article on Leonardo da Vinci:
I can't overemphasize how goddamned ridiculous it is that Da Vinci conceptualized the freaking helicopter at a time when most people were riding around on donkeys and using a sundial to approximate the time of day. Seriously, the freaking printing press was considered cutting-edge technology in these days, and Da Vinci was one step away from dusting Versailles in a goddamned Apache Gunship.
I suppose I could make some point about how "even you can be a badass," but lets face it. That's probably not true. The whole reason stories about these people are worth telling is that the average person simply cannot do what they did. That's what makes the story legendary, after all. You are not Johann Sebastian Bach. You aren't Prince. You aren't even Hannah Montana, and you never will be. Neither will I.

But that doesn't bother me. Humanity has done some truly impressive things, including walking on the surface of the moon and returning to talk about it. It's worth taking the time to be legitimately impressed, to really understand what makes these feats of strength so difficult and how certain humans triumphed over them anyway.

Monday, October 19, 2009

We Can Worry About That Later

As I've been in the middle of purchasing a house, my life has been extremely hectic. The past several weeks have been filled with housing inspections, mortgage application, reviewing and signing legal documents. And naturally every detail has someone who wants to renegotiate it. After closing, we'll still have painting, moving, decoration, and furniture purchases to handle. My life is really stressful.

A few days ago my wife and I were reviewing the upcoming task list and for one item I mentioned, "we can worry about that later". I then realized I use that phrase an awful lot, and to me it means "we can handle that later". In other words, to me worrying is synonymous with work. Put negatively, I don't stop worrying until the work has been completed.

It was an excellent moment of self reflection. I simultaneously realized why I'm so driven, intense, productive, and stressed. This life attitude has its benefits, but it's certainly not healthy in the long term. A few weeks ago I wrote about how the secret of a successful marriage is reducing stress. Perhaps it's better to say:

The secret of happiness is reducing stress.

After all, what else is stress but discontent about the possible future? It's a tricky balance though. If you live life in the future, you'll solve all these potential problems but always be tense as a result, never enjoying the present. If you live in the present you'll enjoy it only until something happens that you should have dealt with. How do you focus on the present while building your future? Personally, I feel like I don't balance these constraints very well.

So I've been thinking about different ways to manage stress. Some common things people try include:
  • Eat and/or drink
  • Have Sex
  • Exercise or spend time outside
  • Sleep or practice deep breathing
  • Read a book, watch a movie, or play a game
  • Daydream or imagine good things
  • Procrastinate by doing less important work
  • Remove the source of stress
Personally I spend a bit too much time on the last two items. Classifying these options, they seem to fall into one of three categories:
  • Solve the issue
  • Ignore the issue
  • Accept the issue
Unfortunately if the only mechanism for relieving stress is to solve the problem, you're in for a rough life-- there's always something else you can worry about, and many things you can't fix Ignoring issues seems fine for small problems. And acceptance is the only option available for problems too large to be solved or ignored.

I believe the real secret to happiness is properly identifying which problems should be accepted and which should be solved. And then realizing that most problems are of the former type. It's easy to get caught up in trying to fix everything, especially as a perfectionist. But the more you genuinely accept misfortunes as Not A Big Deal, the more you can enjoy the truly good things in your life.

If that's true, then the real secret to happiness is forgiveness.

Monday, October 5, 2009

Squeezing The Margins

My father has been a business consultant for decades, my mother is a certified financial planner, and my brother has run several small companies. So as you'd expect, my family talks a lot about money-- both now and when I grew up. Much of the discussion is about how to make the most money.

For example, if you have a savings account that earns 3% a year and have a credit card balance that costs you 10%, you have no reason to keep anything in savings until that credit card is paid off. Not paying off the credit card costs you 10%, bringing the net return on savings to 3% - 10% = -7%, or a 7% loss. The 3% return isn't the full story on investment. You also lose 10% in "opportunity cost", since saving the money means you forgo the opportunity of paying down debt.

On the other hand, if you have some subsidized government school loan with a 4% interest rate and you are earning 5% on average from savings, you will make more money by paying the loan off as slowly as possible, putting all additional money into in savings. When you put $100 into savings rather than paying this loan, you owe 4% more in loan interest ($4) but earn 5% more in savings interest ($5). This is a net gain of 1% ($1).

I've heard all kinds of other, more complicated ideas to leverage money for potentially greater returns. All the ideas come down to this basic concept though:

Maximize the spread between your expected investment interest rate and your debt interest rate.

If you could get a loan with a 7% rate that funds a business with an expected return of 8%, then that's 1% better than not doing anything at all. In theory.

The problem is that more complicated investment strategies have a greater chance of going wrong. There's simply more potential source of failure. In the real world there is no such thing as a guaranteed 8% return on investment. More typically what happens is that there's a pretty high chance that there will be between say, 6% and 10%. And there's a very low chance you'll get a 0% return or even less. So maybe you'll get lucky and get a free 3%. But another possibility is that the investment will give 6%. The business would consider this a success, but it cost you 7% to make this investment, so you're down 1% for your effort. And there's always the chance of a catastrophic failure, meaning you lose most or all of your investment.

Lately I've been rethinking this strategy of squeezing the margins. The increased risk is certainly part of it. Mathematically you will maximize your money if you go from a guaranteed $1,000 to anywhere between $900 and $1,400 most of the time and occasionally $0. But maybe maximizing your money isn't the end goal of life. The potential life impact of losing between $100 and $1000 is probably a whole lot worse than the best case scenario of gaining $400.

Additionally though, more complicated investments just take more time to manage and stay on top of. The purpose of money, at least in my life, is to give me more time and reduce my stress. Working hard for an extra 1% isn't worth it if I can't turn that money back into the time I spent to get it. Squeezing the margins isn't the key to financial security, though it does maximize your odds of getting lucky and striking it rich. Here's the strategy I use:

Reduce, Reuse, Recycle

This is the recycling motto. Most people don't know this, but these steps are ordered by importance. In other words, the most important thing you can do is reduce the amount of things you obtain that need to be recycled. The second most important thing is to reuse the things you have. And if can neither do without them nor reuse them, then as the last option you should recycle them. Sadly most people these days focus on "recycle" and ignore the other two.

This mindset applies just as well to finances though, and with the same priority scheme:
  • Reduce: Don't buy things you don't need
  • Reuse: Don't have money in so many places you can't keep track of all of it
  • Recycle: Put your money in the place it gives the highest return
That third rule is the same one as "squeezing the margins". Squeezing gets you into trouble when it violates the second rule-- once it takes a lot of effort to manage your investments, you are setting yourself up for a fall. But most importantly, the secret of wealth is not buying things you don't need.

Monday, September 21, 2009

A Pearl of Great Price

My wife and I have been house shopping for most of this year. It's an interesting experience. How many things in your life do you buy that cost over $100,000 and take over a decade to pay for? The process is exactly what you'd expect of a six digit purchase-- exciting, intense, stressful, and a bit scary. The whole thing is making me rethink my basic economic mindset.

If you go to a store to buy something you think will cost $100 and it actually costs $110, more likely than not you'll buy it anyway. Presumably you went there because you needed it. Driving around hoping to save $10 probably isn't worth the time. And even if an economist's equations state the value of time is worth it, most people just won't bother.

But think in terms of a house. If you plan on spending $200,000 and the house you want actually costs $220,000, what do you do? $20,000 is a lot of money, and even if you're willing to pay it, you might not qualify for the higher mortgage.

There was an interesting study done on how price changes affects willingness to buy things. In an experiment, they presented some people with this situation:
You have decided to buy a full package vacation to Hawaii. The price is $2000. But when you sign up to pay, the price has dropped to $1600. Do you still buy it?
Obviously everyone still does. Keep in mind that $1600 is a pretty good deal for a full package vacation. Then they gave people a different situation, with only the prices changed:
You have decided to buy a full package vacation to Hawaii. The price is $900. But when you sign up to pay, the price has increased to $1200. Do you still buy it?
Overwhelmingly people in this situation will not buy the vacation, despite $1200 still being an amazingly cheap price. For some reason, we as humans get fixated on the relative differences between prices. We approach the situation as, "If I buy the $1200 vacation, I will have to give up $300 in other things I wanted to get." It doesn't matter that we can't think of what those things are, nor that $1200 is still a great deal. It's just that by comparison, the option that is no longer available is superior. People would rather choose nothing than accept the feeling of a loss.

Note that this is distinctly different from the traditional economic view of humans as rational consumers. Economics is on the assumption that humans rationally choose things that maximize utility, the benefit the consumer gets from consumption.

Suppose someone values a vacation to Hawaii as being worth up to $2000. That is, if given the choice between gaining $2000 and gaining a vacation to Hawaii, they would have no preference between them. For any value above $2000, they would prefer the money, and for values below $2000, they would prefer the vacation. According to economic theory, this person would have bought both the $1200 and the $1600 vacation in the experiments above. But the experiments prove that this is not how humans operate. At best, humans act semi-rationally. And the extent of "semi" is up for debate.

For me, this is the hardest thing about house shopping. I realize it's in my best interest to act like the rational economic consumer. I want to act that way, but my brain isn't wired like that. There is this concept of "fair market value" for a house, which essentially means, "what everyone else thinks someone else will pay". But as what prices people will pay depends on the relative context of other prices, the fair market value is at best a hazy estimate.

What I'm learning is that while fair market value might affect whether a bank will give you a mortgage, it shouldn't affect your buying decisions one bit. Yet it's human nature to think it matters. Buying a house for $200,000 with a fair market value of $220,000 doesn't make sense if the house doesn't provide $200,000 worth of value to you. If it isn't the right size, in the right neighborhood, and so on, don't buy it even if it's theoretically a good deal.

Fair market value doesn't tell you whether you'll enjoy your purchase. At best it tells you what kind of bargaining the seller might accept. When you compare prices to fair market value, you are making the same mistake that vacationers face with the $1200 Hawaii vacation. You are comparing an option available to you ($1200 or the seller's asking price) to an unavailable option ($900 or the "fair market value"). That's not a good basis for making financial decisions.

The rational choice is to compare the seller's asking price to prices from other sellers. Suppose you like a place but the seller wants $240,000 for it. Compare it to other available homes with similar features. If the next best option costs $260k, then $240k is good deal, fair market price be damned. And that's doubly true if you haven't found any suitable alternatives.

It's easy to fall into the trap of thinking of financial success means maximizing your money. Money is only as useful as the things it can buy. It's better to make decisions that maximize the number of things you want to have. It's true that saving money is the best financial decision the vast majority of the time. But when you find what you're looking for, be willing to pay whatever you can afford to get it.

Monday, September 7, 2009

Being Mr. Right

I've been happily married for the past nine years, and we dated over four years before that. Like everyone, we've had ups and downs, but the experience has been overwhelming positive. We have very much grown together. We complement each other well. Not everyone has the same experience, however. I'm conscious that our happy marriage is in large part because of the effort we've put into it, not because "we're so totally in love" or "we're perfect for each other". Those things are true, and they're required for a successful marriage. But neither being in love nor being compatible are sufficient. Contrary to popular opinion, love isn't all you need. If you want your marriage to be a success, or any relationship for that matter, it helps to understand the purpose of that relationship.

When we were teenagers, my brother said something really insightful to me:
Americans don't get divorced when they fall out of love. They get divorced when it's less trouble than staying married.
His point was that many people stay in unhappy marriages because to them, it's better than being alone. But ultimately he's hinting at a rather pragmatic view of marriage. There's so much description of marriage in terms of love and everlasting commitment, but I think that glosses over this simple fact:

People get and stay married because it improves their life.

Simply stated, people think they are happier married than single. The list of common causes for divorce looks strikingly like common causes for depression:
  • Financial trouble
  • Child raising issues
  • Sexual incompatibilities
  • Infidelity
  • Lack of Communication
  • Physical or Mental Abuse
  • Addictions
  • Lack of Compatibility
Really, all these issues boil down to one root cause:
  • Stress
Either the couple disagrees about how to handle an issue and knows it (a disagreement) or they don't know they've disagreed (a miscommunication). Suppose one person wants to spend money on food, housing, and a fancy car. And the other person wants to spend it on food, housing, and travel. If they buy all four things and get into debt, they'll end up in a situation where they can buy neither fancy cars nor nice vacations. Financial stress will tear a marriage apart.

But so can any stress. When parents disagree about how children should be raised, they are likely to blame problems the children create on the other spouse's decisions. If one spouse wants sex once a day and the other wants it once a month, then at least one person will be unhappy, but probably both.

The secret to a successful relationship is using it to reduce life stress rather than create it.

That's why love is necessary but insufficient. Love is merely the motivation that makes you decide the other person is worth the effort. The secret ingredients are solid communication skills and a willingness to compromise.

Good communication prevents small problems from becoming large problems. For example, suppose one partner says, "Lets talk about that later" whenever she's feeling a bit overwhelmed with an issue and needs some time to process alone. But her husband interprets that as, "I don't want to talk about this at all." He might end up feeling emotionally shut out by her. And she might feel neglected because he never initiates the conversation at a later date. This problem is completely avoidable as long as both people take the time to express how they interpret what the other person says and does. The misinterpretation would be immediately clear. Without taking time for that though, these irritations build up into years of needless emotional pain.

Of course, sometimes both people understand each other perfectly well but disagree about what they want to do. In the case of a husband who wants to buy a fancy car and a wife who wants to travel abroad, trying to do both will put them in financial trouble, so that's not an option. Sometimes they just have to compromise on what they want for the sake of the other person. Maybe that means buying a Nissan instead of a BMW, and that they travel to Miami instead of Paris. Or maybe it means they travel to Paris this year, but they buy a BMW in two years. Both people need to realize that their needs can't be the first priority 100% of the time, nor can the same be true of the other person. The overall happiness of the couple needs to be more important than any one particular desire.

There are also situations where couples understand their differences of opinion and are unwilling to compromise. Abusive relationships fall under this category. When the husband believes it's okay to beat up his wife and the wife disagrees, they shouldn't compromise by saying it's only okay to beat her on certain days of the week. If you can't agree to disagree, that's a sign the relationship needs to end. No amount of love or compromise will stop an abusive spouse or convince someone to quit their drugs. They've declared what they want out of life, and it's simply not compatible with what you want.

This is really the category of "irreconcilable differences", and applies to innocuous things as well. For example, desired frequency of sex. If one person is unwilling to have sex more than once a month and the other person wants sex daily, there aren't a lot of options. One person could start having an affair, they can agree to an open relationship (essentially a sanctioned affair), they can "compromise" by only having sex monthly and building long term resentment, or they can break up. Breaking up seems like it causes the least emotional pain in the long run in most cases, which means it's often the best choice. There's no shame in breaking up when you realize things won't work out. You just weren't the right people for each other.

Monday, August 24, 2009

Self Education

We can say that Muad'Dib learned rapidly because his first training was in how to learn. And the first lesson of all was the basic trust that he could learn. It is shocking to find how many people do not believe they can learn, and how many more believe learning to be difficult.
I strongly believe in the value of higher education, but it's just a guidance and support network. The real motivation and effort must come from the learner. As such, I also support autodidacticism, the practice of self-directed learning. I don't just link Wikipedia pages as an academically offensive form of citation. They contain information that's genuinely useful and accurate more often than not for people who want to learn more.

There are famous autodidacts in virtually every field of mathematics, science, music, and the arts. The list includes Albert Einstein and Frank Zappa, for example. That suggests there are no subjects a self-learner couldn't learn to master. The barriers are just natural aptitude and motivation, not field of study. Of course not everyone can understand quantum mechanics. But I suspect more often than not, people are held back by a lack of motivation, not a lack of aptitude.

That's not to suggest raw talent isn't important. Famous self-learners are famous explicitly because they happened to be so excellent in their field. Of all the people in the world, on those who both try to learn physics and have the talent will become the next Einsteins. Isaac Newton is famous for his work on Mathematics, Gravity, and Optics. But he also spent years working for the Royal Mint. We remember him most for the areas he excelled at.

I don't think it much matters if you try something new and aren't amazing at it. As long as you enjoy it, it's worthwhile. Over the past few months I've been teaching myself how to play classical piano. I'll never be Bach or even just a concern pianist. But I will be good enough that I can play some of Bach's works and that's all that matters to me. More than latent ability, I believe the most important factor is the audacious belief that you can teach yourself sometime new. BrainWorks itself is the result of that belief. I started with no relevant formal training in artificial intelligence and produced some pretty groundbreaking game AI.

You don't have to pick classical piano or AI research if you don't think you're up to the task. But surely there is something you don't know but could. Can you solve a Rubik's Cube? What meal do you enjoy the most that you can't yet cook? Do you know how a television works? What about how the Enigma code was broken in World War II? Can you sail a sailboat? Do you recognize constellations in the night sky? Have you ever made a piece of pottery? Repaired an automobile? Written a short story?

Humans are far wealthier now than at any previous time in history, and the mere fact that you can read this on a computer proves it. The latest Wall Street fallout is a drop in the bucket compared to the technological gains of the past century. More wealth converts itself to more leisure time if you want it to. That makes this coming century the setting of the greatest potential renaissance ever. Don't waste that time on television or Facebook. Find something you don't know you love and master it!

Monday, August 10, 2009

Follow Your Dream

I've been watching some presentation videos on TED.com from their yearly conferences and as I scientist, I've found them very inspiring. There was a demonstration of a cheap water filter that could be deployed across the entire globe and seriously reduce infectious diseases that billions of humans are currently in danger of. Deaf percussionist Evelyn Glennie talks about music and listening. I watched a video of Elaine Morgan talking about the major differences between humans and other great apes. She makes a compelling argument for humans evolving from a species of apes that lived in water.

But most of all I appreciated this talk about living a passionate life. The speaker tells a story of a Yugoslavian Jew who escaped Nazi Germany and at every stage in his life found the resources to make a profound impact on the region he was living in. After watching these videos, I found myself very motivated to make an impact on the world at large. I believe that in several decades, I too could present something of value, and if I don't do that, then perhaps I'm not living up to my potential. But then I wondered if my motivation was misplaced. Michael Pritchard worked on a water filter because he was dismayed by the aftermath of Hurricane Katrina, not because he wanted to "make an impact on the world".

I rethought all the presentations, trying to find the common thread. What did these these people have in common that helped them accomplish their dreams? They all have some raw talent, but primarily I got the sense they were strongly motivated, and their motivation was directly for the the task they wanted to accomplish. Evelyn Glennie wanted to be a musician even though she is deaf. Through this she has become inspiring, but her motivation wasn't to be an inspiration.

Rather, I see these characteristics making up their stories:
  • Be motivated by the dream itself, not the result of the dream
  • Make plans on the scale of decades but don't follow them exactly
  • Don't ever give up when facing opposition
All of these people are somewhat talented and have a clear wealth of motivation. There weren't any presenters who were totally brilliant but only somewhat motivated. Success is about persistence. Each person had enough motivation to focus on something that would take years or decades accomplish. They all got discouraged and did not quit. When something stood in their way, they changed their plans to get around that obstacle. This leave us with two questions to answer:

What things do I care about?

How can I increase my motivation?

No two people have the same answers for these questions, and I believe you can only find these answers through introspection. In general though, people are motivated by positive feedback, concrete objectives, and small, discrete tasks. Things get hard when there aren't any positive results, the objective isn't clear, and the tasks can't be easily divided into portions.

This suggests that successful people are intrinsically optimists with a healthy dose of realism. They need to believe things will work out even when there's no feedback suggesting that while remaining grounded enough to change plans to get around adversity. Too much optimism and you'll stubbornly try the same thing and fail. Too little optimism and you'll just quit.

The good news is that this provides a metric for determining what you need to change to achieve your dreams. If you try things and then quit, then you need to become more optimistic. If you keep trying the same thing and it doesn't work, you need a healthy dose of reality to see why your original plan didn't work and how to revise it. If you try different things and they don't work, expand the realm of your search. But don't ever give up on the things that truly matter to you.

Monday, July 27, 2009

Only When It's Funny

As I believe the purpose of life is to be enjoyed, making people laugh to be one of the most important things I do. That's ironic, given that this blog is particularly unhumorous. Don't worry thought; that's not a mistake I intend to correct today. Rather, I want to share a bit more about humor and what makes things funny.

When I was a kid, I saw the movie Who Framed Roger Rabbit. While it's full of cliche and loaded with cheap slapstick gags, it also includes a surprising amount of sophisticated humor and wit. I'll always remember one line from the movie though. Roger Rabbit is wanted for murder and trying to avoid the police. He inadvertently handcuffs himself to detective Eddie Valiant. The two finally make their way to a safe location where Eddie gets his hands on a hacksaw to remove the cuffs. If you want to watch how the scene unfolds, here it is.

Roger just slips his hand out of the cuffs and asks if that helps. Eddie is clearly pissed and asks if Roger could have done that at any time. Roger responds:

No, not at any time. Only when it was funny!

I love the implication that the toons don't have complete and total power over reality. They can only break the laws of physics when its funny to do so. For example, Wile E. Coyote is only allowed to run off a cliff and walk on air when he doesn't notice he's not standing on solid ground anymore. Once he realizes that he's supposed to fall, he falls.

Furthermore, Roger's response speaks to the value of comedic timing. Things are funny in large part because of their context. If you watch any professional comedian, you'll see a clear difference between waiting one and two seconds before delivering the next line. Some responses would simply be less funny if the response was one second sooner. John Stewart of Daily Show fame is a particularly good example of this. Comedians with perfect timing learn just how long they need to wait before their audiance comes to a certain mental conclusion. The humor derives from constrasting the comic's next statement with your current thought, and if the line is delivered too soon (or too late), it doesn't provide the right contrast.

Of course, knowing that timing matters isn't the same as knowing what to say or when to say it. No two people laugh at the same things either, so humor is a very personal thing. What makes something funny anyway?

I believe all humor reduces to cognetive dissonance between expectations and reality. When you expect life to be one way and it's different, your mind has a few possible responses. You either get offended or you laugh about it. Which response you have depends on how much you care about the topic. For example, suppose you mention that you've been feeling a bit sick for the past few days and your friend deadpans, "It's probably swine flu." Whether you chuckle depends on whether you actually think you have swine flu.

Not to be pedantic, but it's worth analysing this joke in detail. The crux is that people overestimate the probability and danger of catching swine flu. Your friend is pretending to be one of these people who overreacts, pointing out the reality of these people. Rationally we know that the odds of actually catching it are extremely low-- more people die of the regular flu than swine flu. So in an ideal world, people wouldn't be worried about it, and that's the source of cognitive dissonence. The joke boils down to, "people are worried about swine flu but shouldn't be."

If you agree with that statement, you'll laugh with your friend. But if you think people aren't overestimating the deadliness of an epidemic which has claimed far fewer lives than car accidents have in the past six months, you'll be offended. Your friend's joke became a criticism of your own perspective.

And that's the beauty of comedy. Laughter is a reflection of what we consider unimportant, and the vast majority of our lives really don't matter. A 14 year old girl might be mortified for farting in class, but she would be a lot happier if she could laugh like the rest of her classmates. After all, no one cares as much as she thinks they do. If you want to be happy in life, you have to be humble enough to accept that you just aren't that important. Only then can you laugh at just how crazy and awesome this world really is.

Monday, July 13, 2009

Imitating Life

As a hobbyist game designer, I quickly learned a simple truth about game players:

Players always know whether they are having fun but rarely know why.

If you don't believe this, read the fan forums for literally any game you can think of. You'll see all kinds of suggestions, 80% of which would clearly make the game less fun. But when someone says, "I don't like it when this happens," then they're stating a personal opinion. It's not a debatable point-- they are certainly not having fun. This is a bit ironic. How can they know what they like but not why they like it?

The answer is that while humans are capable of self reflection, they aren't actually that good at it, nor do they usually enjoy it. Humans excel at pattern matching and general recognition problems. Not coincidentally, the vast majority of fun in games comes from what could be abstractly labeled "pattern matching".

Pattern matching is more than just seeing the Virgin Mary in a grilled cheese sandwich. In an abstract strategy game like Chess, it involves recognizing a board position as similar to one you've played before, so you have an idea for how to approach it. In Poker, you learn to recognize how a player's bids correspond with their potential hands. Basketball and football players need to recognize openings in the opposing team's defense. Party games like Charades and Apples to Apples are nothing but pattern matching: can you connect the dots between someone's gestures and a previously known phrase?

So I was intrigued after reading an article by Mark Rosewater on resonance in Magic: The Gathering. A game mechanic has "resonance" if it reminds the players of already known concepts. If you see that a dragon has the special power "flying" or giant has "trample", you don't even need to know how the game works to appreciate the design. We know that dragons fly, giants are large, zombies are slow, merfolk swim, and so on. It's just fun when a game does a good job of embodying its theme! And game mechanics with resonance are also easier to learn, since you can apply your standard intuition to situations they apply in. You would assume that a creature with flying is harder to attack and has an easier time attacking other people. A trampling giant probably causes more damage on average than another creature would. Zombies are probably weak overall, but easier to use as minions than something like a Dragon.

I confess this lesson took me a long time to learn as a game designer. The first games presented players with interesting decisions but totally lacked theme and resonance. This made them as entertaining as sudoku, which puts them the same realm as, "things I'm willing to do while in a train." Not exactly a rousing endorsement. But just because of how our brains are wired, humans just like seeing connections between abstract actions and known concepts. When kids play cops and robbers, "house", or pretend a doll is a real baby, they are taking enjoyment from resonance. Since even the very young participate in imaginary play, it suggests this enjoyment is somehow wired into our brains. Some people think of games as escape from real life, but it's specifically when games are connected to life that they are most enjoyed. A game doesn't need dragons, ninjas, aliens, or Roman emperors to be fun, but these things help a lot. Especially the ninjas.

Monday, June 29, 2009

Optional Law

Imagine there was a law that required everyone to pay a $100 tax each year. However, there is no way to find out who paid their tax and who didn't. All the government knows is the total amount of money that comes in and therefore the percent of people paying the tax. Is avoiding this tax ethically justifiable?

I don't mean to suggest that actions are only unethical if you get caught; I don't believe that is the case. When 10 people commit similar crimes and only 9 get caught, that doesn't make it right for the guy who got away. Rather I'm asking whether it's ethical to break a completely unenforceable law. I'm not sure, and perhaps it depends on how heinous the forbidden action is. But our perceptions of right and wrong change over time.

As a concrete example, consider the anti-sodomy laws that many American states had before they were struck down as unconstitutional. These laws restricted the sexual conduct of consenting adults and were virtually impossible to enforce. In the centuries since these laws were first passed, the majority public opinion no longer regards oral and anal sex as immoral.

The general argument against unenforceable laws is that they only punish people honest enough to follow them. In the tax example, both honest and dishonest people would get the benefit of however the nation spent the tax money, but only the honest people paid for it. This is not fair, though even unfairness does not necessarily make ignoring the law ethical. The argument also gets murkier when the law is more than 0% unenforceable, and when the prohibited action has a negative impact on society as a whole. Murder is wrong even if it could never be enforced, for example.

A more recent example is the set of laws against unauthorized music downloads. Music companies don't want people using the things they produce without paying for them, but modern technology has made it very easy for people to do this anyway. The basic structure of the problem looks like this:
  • Party A (the music company) owns the rights to some information.
  • They allow party B (the purchaser) to use this information, but not to distribute it.
  • However, they cannot prevent party B from giving it to party C (the downloader).
At first, music companies tried to stop downloaders, but it's really too difficult to figure out who they are. So the latest tactic has been going after purchasers who distribute the music online. Even that has been very difficult, often requiring subpoenas to ISPs, and these tactics have not substantially increased music company profits or decreased illegal downloading.

The question is whether it's ethical to download music you haven't purchased. There is not much benefit to society from unauthorized downloading, but there is also not much cost. It's true that record companies lose some money from people who would otherwise have paid, but not every downloader was a potential customer. Plus the increased exposure from free downloads has in some cases turned into more paying customers, though I suspect the net effect is still a loss most of the time.

At any rate though, the real problem is that music companies are distributors who can no longer control their product distribution. No amount of legislation can make this business model profitable again; they need to find a new way to add value to customers before customers will give them money again. I'm undecided about whether illegal downloads are ethical. That said, music companies need to suck up the fact that it will happen anyway and stop trying to fix unsolvable problems.

Of course, it's easy for consumers to tell that to music companies, but harder to take that advice yourself. Here's the grand irony: The same people who support legalization of free online music are generally opposed to unauthorized government surveillance. When it's someone else taking their own words without permission, they strangely don't see freedom of information in the same light.

But the government's wiretapping program has clear parallels with music downloads:
  • Party A (music companies or a citizen on a phone) is the owner of information.
  • Party B (music purchasers or the telephone company) was given this information with the understanding it would not be given to people that A did not authorize.
  • Party C (music downloaders or the government) was given the information by party B anyway.
Similarly, it's not clear what the costs and benefits to society are. The government might be making the country more secure, or maybe the information doesn't help. No one wants to have their privacy invaded, so clearly there is a cost, but I'm not convinced the cost is freedom. Using the information as a way to ferret out "unpatriotic citizens" isn't that practical given the volumes of data that need to be analyzed by hand. Government agencies only have so much money to spend, and the biggest threats to national security are not unpatriotic ideas-- they are crazy people with bombs.

The biggest societal danger is of high level politicians trying to access information from specific domestic adversaries and using it for personal gain, but you don't need a massive government program to cull information on just a few thousand civilians. While this danger is real, I suspect it existed well before the Bush administration set up this widespread surveillance program.

So just as I haven't made up my mind about music downloads, I also can't decide on warrantless surveillance of citizens. They seem similar enough that they should both be moral or both be immoral. It's possible to argue for one and not the other, but that's a difficult argument to make; I'm not sure what that argument would be.

But there's one thing I am certain of:

Like the music companies, we should worry about solvable problems, not unsolvable ones.

No amount of legal pressure will have any impact on warrantless wiretapping. If you really care that the government might find out that you're meeting friends for drinks, then don't tell people that over the phone. Certainly you should stop posting it on Twitter. Or alternatively, learn to care just a little less about privacy. In the grand scheme of things, none of us are really that important, so you might as well be happy instead.

Monday, June 15, 2009

Learning to Learn

As a child I didn't care for most kids my age, generally finding adults to be more interesting. As a teenager I realized that not all adults were interesting either. Some adults always had new stories and ideas to share and liked listening as well. Others adults were set in their ways, only repeating the same concepts over and over. In retrospect, I was measuring their open-mindedness. On average it seemed like older adults were more likely to be close-minded, but that wasn't always the case. I knew interesting people in their 50s and boring people in their 20s.

I eventually concluded that the capacity for learning was what made people interesting to me. Adults stopped being interesting when they stopped learning. Most high school kids hadn't learned how to learn. And many adults stopped learning after they left college. This also explained why I got along best with college students and professors, even as a 13 year old. College is the environment that most demands an open mind. As a teenager, I resolved that I would never stop learning, lest I become that same kind of close-minded adult.

Lately I've been reevaluating my for learning. I've been at my current job for close to a year, doing research into helping computers understand natural language. The median degree among my coworkers is a Masters of Science, and there are a number of PhDs working for the company as well. Having an advanced degree generally means you understand your subject matter well, but it has no correlation with your ability to teach the subject to others. Some PhDs are great teachers and some aren't.

In this work situation, there's a lot of opportunities for teaching and learning, and generally it's more challenging than learning in school. Even in college I typically understood things without much effort. I got excellent grades in hard courses while putting in half the study time or less of others. But at work, learning new concepts often takes much more effort than I'm used to. There are a few possible explanations:
  • It's me: My capacity for learning has decreased
  • It's them: Some people aren't very good instructors
  • It's the subject: Research is harder to understand
I spent a lot of time thinking about this and I think the issue is the subject. Learning in school is very different from a work environment. In school, the information is well understood and presented in pre-digested manner. The instructors are paid professionals. Schools are supposed to be ideal learning environments, and while I have issues with the modern schooling system, it generally meets the objective of disseminating information.

Contrast this with learning in research environment. Innovation skill matter more than communication for researchers. And because the very topic is being researched, even the person explaining can have a weaker grasp on the overall concepts being explained. So learning in this situation can involve more than just figuring out what someone is saying. You must also determine what they tried to say and sometimes even what they should have said.

I'm convinced that I need to better learn how to learn. School is good for spoon-feeding information to masses of children, but it won't teach you the art of learning. A good university gives you the opportunity but it's still no guarantee. Learning is more than just obtaining information. It requires synthesizing new concepts from data and extracting data from concepts. A good curriculum draws clear lines between concepts and data, but most people do not. And that's why learning is difficult.

Monday, June 1, 2009

Bring The Future To Pass

I last wrote about the evolution of civilization and wrapped up by concluding that almost all world-changing inventions involve making it easier to move materials and information. The past century in particular has brought astounding technological marvels, far more impressive than the last several thousand years combined. It seems reasonable to conclude that this next century will put the past to shame, as will the one after that.

But what kinds of things can we expect of future civilization? Predictions of future technology are remarkably hit-and-miss. In the 1950s, people were predicting flying cars by the year 2000. But people in the early 1900s also predicted things like email and television. I think the lesson is that it much easier to move information than matter.

So at the risk of being wrong, let me make my own technology predictions for the future:

Abundant Electricity:

There isn't enough oil to provide for more than a few more decades of consumption at current technology levels. And while our coal and uranium supplies can last for a few centuries, they won't last for a few millenia. But since the use of electricity, every major invention has depended on it. The earth can support life for millions of years, but without a more efficient means of generating electricity, humanity won't be able to survive in its current state for long. Better use of nuclear and solar power will help this. But long term, hopefully humanity will develop some kind of new technology like cold fusion, if its even possible.

Artificial Intelligence:

I believe true AI, one that can pass a full turing test, is the ultimate goal of civilization. An artificial intelligence is essentially a thought generation machines. This is an incredible boon for any area of scientific research, as it enables the easy recruitment of able-minded researchers. Estimates on when this can occur range from decades to centuries, but most scientists believe it is possible. I'm in agreement that this is both technically possible and extremely difficult. There is also the distinct possibility that even after the first AI is created, it takes centuries before more than a handful can be created. The energy requirements for this kind of technology could be unimaginably large in today's terms. But if and when it happens, civilization will change forever. Hopefully for the best.

Matter Synthesis:

A large portion of new discoveries depends on very rare or hard to obtain materials. For example, most superconductive materials require extremely strange composites. Or consider the extraction of aluminum. It requires a crystal that can only be found in large quantities at a specific mine in Greenland. The mine is now empty, but a synthetic version of the crystal is an acceptable substitute. And these days, scientists can even turn lead into gold-- they just don't do it because the energy cost is higher than the value of the gold. A low energy method of creating arbitrary elements and basic crystalline structures will go a long way towards ensuring the technologies we develop can be deployed for lower production costs.

Space Elevator:

The earth can sustain life for millions of years, but eventually this planet will become inhospitable. If humans cannot learn to survive in space or on other planets, we will eventually go extinct. And while a few of the richer nations have space exploration programs, we are nowhere near having a real colony in space, much less the moon, mars, or another solar system. The issue is that the cost of even getting things off of Earth is very high. Each pound of cargo costs on the order of $10,000. There is research into cheaper means of propulsion, but the best hope seems to be a space elevator. Conceptually, a space elevator is a structure connected to earth that is high enough that the top is in geosynchronous orbit with the planet. Then goods could simply by hoisted up for a fraction of the current cost. Think of it as the world's largest dumbwaiter. There are some clear technical challenges to a construction like this, but it would mark the beginning of the industrialization of space.

Disposable Electronics:

For decades, people have talked about how extremely portable computing devices could change our lives. Many people have suggested the logical conclusion is the human/computer hybrid known as a cyborg. In other words, humans will be embedded with microprocessors. I actually think this concept is a bit farfetched. This is primarily because the mere suggestion of this technology offends the moral sensibilities of many people, so it has major political obstacles. But there's clear utility to having processing power everywhere, as shown by the popularity of Apple's iPhone. It's more likely that electronic devices will instead get so cheap and thin that they will be everywhere-- built into the side of a can of soda or on the cover of a book, for example. And all of it will have wireless network connections. This sidesteps the discussion of embedding technology in human flesh while meeting the objective of ubiqutious computer interfaces.

All that said, I'm sure there's another dozen things I haven't even considered. This is such a great time to be alive! Celebrate the extreme unlikelihood of having life at such a wonderful time in history and cherish it. When you think about it, each person's life is much better than they give it credit for, simply because it is life.

Monday, May 18, 2009

The Meaning of Life

When I was a Christian, one of the biggest comforts was having a well defined purpose to life. The greatest thing was to glorify God. That's easy to do on Sunday, but I figured that if God was as incredible as Christianity claimed, it was worth honoring God every day of my life. After thinking about this for a while, I decided God must care an awful lot about humanity, and seeking the advancement and peace of human civilization was the primary method of bringing God glory on a daily basis. This kind of thinking is supported by Bible texts such as "If you love me, feed my lambs", the parable of the talents, and the parable of the sheep and goats.

Psychologically, losing meaning in life was one of the three hardest parts about converting from Christianity to Atheism. However, I soon realized that removing God from the equation didn't have to change anything. I could still find meaning through the advancement of human civilization.

As a result, I've become interested in the origin and destiny of civilization. I consider a group of people to be a "civilization" when there exists a caste of the population that spends a large portion of time in activities other than the acquisition of food and reproduction. So a group of hunters living in caves wouldn't be a civilization until there is some kind of a chieftain or shaman who is supported through food from the other villagers. Civilization can't advance until people have leisure time to spend on art and science, so the beginning of civilization is when some people first have this free time.

Humans have made three major discoveries that were necessary for civilization to begin. They are language, fire, and agriculture. Language is required to share the complex, learned concepts that are the basis of civilization. Fire is required for cooking, which increases the nutritional value of food, thereby increasing the lifespan and health of the population. And farming is the most crucial of all. Through farming, a group of people can produce more food than they can consume. This both provides a buffer against years of famine and allows a segment of the population to spend time on things other than food production.

Once those three things were in place, the stage was set for the rapid advancement of technology, resulting in a far higher standard of living and population than humans had ever seen. The past 10,000 years of life on Earth have put the previous millions to shame. Of the many things humans have invented and discovered, however, I'd like to list what I consider the most important discoveries. All of these you use on a daily basis, probably without even thinking about it. They are:

Writing:

Creating a writing system is not as easy as most people would think. There's an excellent discussion of why this is hard in the book Guns, Gems and Steel. The basic issue is that pictorial systems (like the Chinese alphabet) require memorizing a different symbol for each word, so learning the system difficult. And phonetic systems require a stronger understanding of phonetic units than most people have, to the extent that most people learn English spelling without even understanding the phonetic backing.

The Wheel and Roads:

These two inventions together are necessary to move large quantities of goods over long distances, and is a crucial part of trade with other cultures. Trade is the mechanism by which different cultures share their discoveries.

Currency:

In trade and barter systems, it's easy for a baker who wants meat and a butcher who wants bread to work out a deal. But what happens when the butcher instead wants a knife, the blacksmith wants a table, and its the carpenter who wants bread? Now you have to orchestrate a four way trade. When you expand this problem even to a town of just 1000 people, its complexity as an NP complete problem becomes apparent. Money provides a linear time solution. Every trades what they have for money, then trades the money for what they want.

Mathematics:

Most of the time, having directions or instructions is meaningless unless they are precise. Understanding the relationships between numbers is required for measurements, trades, and general mechanics.

Plumbing:

Once you have even 10,000 people living in the same general area, getting fresh water and removing sewage becomes a genuine problem. Without a good system of moving water, the population is much more likely to contract and spread diseases. Sewers make cities less susceptible to plagues.

The Printing Press:

Even if you have a written language, the production of written documents is time consuming without a printing press. The press allows for mass production of books, which in turn puts written materials in the hands of the common person. That makes it the precursor of widespread education. Historically, the printing press was also one predecessor of the Protestant Reformation, as it enabled the Bible to be translated out of Latin and into a language the average person understood (at least if it were read to them).

Electricity:

Fire is a powerful source of energy, but it's difficult to use. Contrast this with electricity, a power source that can be transmitted over large distances and even stored for later use. Among its many uses, electricity provided more efficient means of lighting buildings. This in turn meant humans could be productive for more hours in the day. It also created more efficient climate control systems for buildings, which allowed humans to live in harsher climates. And it enabled the creation of more efficient factories using the assembly line for production.

Radio Communication:

Three thousand years ago, kings were happy that their exact instructions could be written down and sent to another place in the kingdom within a month or less. But due to the discovery of radio waves, encoded messages can be broadcast across thousands of miles in mere seconds. With radio communication, decisions require crucial information can be made in minutes rather than weeks or even months.

The Internet:

I am convinced that the internet is by far the greatest invention of our generation. While radio and television allowed rich corporations and governments to communicate quickly and easily, the internet has put that power in the hands of the everyone. Massive amounts of data can be send anywhere on the entire planet in a matter of seconds due to the power of the internet. It has brought about an era in which anyone with access to a computer can express their thoughts. And if Twitter is any indication, almost none of it is worth reading. But I hope that this blog can be one corner of the internet where the information is worthwhile.

When I see how far humans have come, I'm excited for the future. Some other week I'll write about some options for what The Next Big Thing(tm) might be. But given the increasingly rapid pace of technology development, it could be something we see in our lifetime. You might notice that everything on this list has to do with more efficient movement of ideas, matter, or energy, so that's a clue for what kinds of technology this next century could bring.

Monday, May 4, 2009

Living In The Right

I recently had the chance to watch Alexandra Pelosi's documentary Right America: Feeling Wronged. (I'm assuming the video is legally viewable on the internet; if it's not, this review contains a reasonable synopsis.) The film follows the McCain/Palin 2008 presidential campaign and interviews the supporters on their beliefs. It's roughly 45 minutes long, but I found it well worth my time.

First, a few disclaimers. Yes, director Alexandra Pelosi is the daughter of current House Speaker Nancy Pelosi. And like every other documentary, I'm sure there's an agenda behind it. But this isn't a Michael Moore documentary, where the whole film is a setup to make a targeted person or group feel uncomfortable and mocked for their beliefs. That's not what this film is about. Alexandra seems to understand that her political connections automatically make her motives suspicious, and she generally works hard to ask unbiased questions, without making the subjects feel like the purpose is to laugh at them. For example, after seeing an ornament at a trailer park labeled "Redneck Wind Chimes", she asked the residents this series of questions:
  • Are you rednecks?
  • What is a redneck?
  • Do you use redneck as a derogatory term?
Whether or not you actually laugh at their responses is your choice. I found most of the people surprisingly articulate, and more than anything, I felt pity for them. At any rate, the movie gave me a lot to think about, but I took two very important things out of it. Both of them changed my perspective on the conservative / liberal divide in America right now.

A) Most conservatives viewed the election as a choice between right and wrong.

Overwhelmingly the people interviewed has the viewpoint that McCain was clearly the right choice for president, and Obama was the wrong choice. In contrast, I feel like most liberal voters considered Obama the better choice and McCain the worse one. In other words, conservatives tended to evaluate candidates from the standpoint of black-and-white morality. For example, if you believe that abortion is a sin, then voting for a president who supports abortion must be a sin as well. That makes Obama an immoral choice.

I believe most liberals evaluated the candidates pragmatically. A typical liberal voter's top issues aren't morally charged in nature, so their voting selection process is based on which candidate will better address their issues. Voting for "the other guy" is merely a bad decision, not something that moves you one step closer to Hell.

B) Most conservatives have logically consistent opinions derived from a different set of premises.

These people gave Obama a good serving of all kinds of random accusations. Different people accused him of being a Muslim, a terrorist, the next Hitler, and even the Anti-Christ. These viewpoints are totally preposterous, but I want to stress that for the most part, the conservatives are acting rationally given their assumptions. If Obama really is a terrorist, then of course you shouldn't vote for him!

Most of the conservatives interviewed didn't even seem to be aware that other people might not share their premises. I got the distinct impression that many of these people couldn't figure out why liberals would vote for a known Muslim, and the best conclusion they can come to is that "those liberals must hate God".

I really want to stress this point, because it's very important. America's far right wing conservatives are not crazy. They are acting rationally from the basis of their premises, and they are not aware their premises might be incorrect. And for the record, liberals are the same. They are also not aware that their premises might be incorrect.

So if someone claims that Obama is the next Hitler because both were charismatic leaders who came to power at times of national distress, you won't make much headway if you flat out disagree with them. Saying, "Don't be silly; of course Obama isn't going to invade foreign nations, killing enormous numbers of innocent civilians," might be true, but it won't change their mind. It is better to discuss their flawed premise rather than disagree with their conclusion. For example, "Lincoln, Roosevelt, Washington, and Churchill were also charismatic leaders who came to power during national distress, and they were some of the best leaders of all time. Being charismatic doesn't mean he's evil."

This doesn't just apply to political groups either. It's easy to assume that any time someone disagrees that they are simply stupid or crazy. But more often than not, they are simply mistaken. That's why I have pity for both rednecks and Christians rather than disdain. And as a Christian, I pitied athiests. The vast majority of people are simply misinformed, and if you take the time to have an honest conversation with them, both of you will be better off for it.

Monday, April 20, 2009

Mental Filters

I write about a pretty wide variety of topics. Some common ones are:
  • Algorithm Design
  • Ethics and Morality
  • Philosophy
  • Politics
  • Learning
While these topics seem somewhat distinct, they all intersect on one question:

What things are good and how can I best do them?

The site's tag line is "Genuine and Artificial Intelligence", but the purpose of intelligence is to do good things, rather than bad things, inefficient things, or evil things. I think of each post as an opportunity to learn how to learn.

So it shouldn't surprise you that I love well reasoned and articulated explanations, especially things explaining how we think. For example, this essay on Lies We Tell Children was worth a blog post. I found one last week on the subject of open-mindedness. It's well worth the 10 minutes, so I highly recommend watching it:



There's a lot of good stuff in there, but I particularly liked the point about mental filters, starting at roughly 7:23. A lot of people think that being open-minded means you are willing to consider any idea, which essentially means your brain lacks a mental filter. They define being open-minded as accepting any idea you are told, no how far-fetched the circumstantial evidence is. What this really means is, "you should agree with me no matter what." And ironically, that's the exact definition of being close-minded, as it means they aren't open to other ideas.

The main point is that being open-minded means considering the evidence and logic for different explanations, then believing the explanations that best fit the evidence and throwing out the ones that don't. In other words, being open-minded is predicated on having an evidence filter.

Everyone is confronted with both true and false concepts all the time, and it's impossible to have a world view that only believes the "correct" things. Statistically speaking, you are virtually guaranteed to believe some ideas that are flat out wrong. But the objective is to minimize the percent of incorrect ideas you believe. That means the key word is "filter". If you have a brick wall for your mind, you are unable to accept any new ideas, so the incorrect premises you have will only turn into more incorrect conclusions. And if you have no mental protection at all, you'll believe all kinds of crazy things.

I believe many people who are truly close minded mistake the mental filters other people have for brick walls. They falsely conclude that because someone rejected their idea, that person must not be open to any opposing ideas, rather than simply having a good reason for rejecting theirs.

All of this is well and good for understanding "the other guy". But how do you make sure that you aren't "the other guy"? Remember, the most close-minded people think they are open-minded, in the same way that arrogant people think they are humble. There's no firm method to conclude whether you are actually open-minded, but keep this in mind: Truly open-minded people occasionally change their beliefs. Ask yourself this question:

When was the last time I philosophically disagreed with someone, and after we expressed our beliefs, they changed my mind?

If you think you are open-minded but can't remember the last time someone else changed your opinion on something substantive, you are probably more close-minded than you think. Recognizing when you are wrong and having the humility to admit it is the true mark of an adult mind.

Monday, April 6, 2009

Ballistic Programming

Last Wednesday I attended a talk at MIT from Larry Wall, the designer of the Perl programming language. The talk was entitled, "Ballistic Programming", but really it was excuse to talk about Life, the Universe, and Everything. And by everything I mean programming languages, their design, shortcomings and benefits, natural languages, grammar, and how his perspectives on all of these things impact the design of Perl.

Perhaps it's better to say that the talk was about "everything".

At any rate, the study of ballistics is literally about the art of projectiles. It's the source of the the term ballista, and it's based on the Greek verb for "to throw". Pretty much every sport involving a ball is a ballistic sport, as well as a few others, like the javelin toss and gun target practice. Ballistics is the art of throwing an object from one point to another, and the process works like this:
  • Select intended destination
  • Estimate force required to move object
  • Make attempt
  • Evaluate effectiveness
  • Correct next attempt using these results
Of course, this procedure applies just as well to programming as it does golf or basketball. Larry had an excellent set of diagrams explaining the two major theories of software project design. First, he showed Waterfall, a complete failure of a process in which each stage seamlessly and perfectly flows from one step the next with no backtracking. It's been known for decades that it doesn't work and causes projects to be over budget, but here's are the stages:
  • Specification (select destination)
  • Design (estimate force)
  • Implement (make attempt)
  • Test (evaluate)
  • Maintenance (correct)
The problem with waterfall is that it has no flexibility anywhere. Sometimes something will come up in implementation that demonstrates an issue with specifications or design, and those portions need to be corrected. But waterfall states that all the specifications have to be done first, then all the design, and so on. Either the whole project gets held up as flaws in the process are found, or the project is completed with flaws, producing something that no one needs and is impossible to maintain.

The other common methodology is known by the laden buzzphrase "Extreme Programming". The two main tenants of extreme programming are that you want lots of feedback loops so problems can be corrected as soon as possible, and that people should program in pairs. Since pair programming isn't relevant to the discussion at hand, I'll just give my two cents and let the issue rest. It's very useful for educating half of the pair and otherwise it's a waste of time, in that it takes more than twice as many worker-hours to do.

Larry Wall joked that in Extreme Programming, you start with the test which shows you how to implement the program. After you've implemented it, you can write your design document, and finally at the end of the project you can write the specifications. In other words, it's the reverse of Waterfall:
  • Test
  • Implement
  • Design
  • Specs
Naturally it's easy to run into problems early if you don't know what your design and specs will actually end up as. And just because you are constantly refactoring when you encounter a problem doesn't mean you refactored in the right way. Knowing something needs fixing is different from knowing how to fix it. Sometimes your next attempt isn't even an improvement on the last issue.

That said, it's is a clear improvement over Waterfall. It's easy for Extreme Programming to beat Waterfall in the same way that it's easy to beat a blind man in boxing. Just because you won doesn't mean you're any good.

Waterfall is always bad, but there's "good" Extreme Programming and "bad" Extreme Programming. Whether or not Extreme Programming works depends heavily on how you skip between the different ballistic steps. Sometimes you start in specs and move directly to implementation, then before you even get to test, you detect a problem in design. You fix the design problem, quickly make an implementation fix to reflect it, and then test it. In you can skip from any step to any other step if you are truly following the fast turn-around tenet to its optimum. In other words, Extreme Programming is just another name for:

Cowboy Coding

Losely put, Cowboy Coding is a system in which "every man does as he sees fit." No system can ever tell you the optimal way to construct the program. There will be speccing, design, implementation, and test, but who knows in what quantities and chronology. Good programmers just know from experience and intuition when to move to the next step. Now cowboy coding is used pejoratively by some programming methodology evangelists, especially those in the Agile community (a subset of extreme programming). When bad programmers try to use Cowboy Coding, the result is always a train wreck. But ironically it's the only good part of Extreme Programming, even if its proponents don't realize it. Think about it like this:

Software design metholodigies instruct programmers when to switch from one ballistic step to the next. Sometimes the methodology's suggestion is optimal and sometimes it is not. Good programmers will generally outperform the methodology's suggestions and almost never do worse. Bad programmers don't know why the next step is the correct one, so even if the methodology suggests the right step, their chances of doing the next step well are low.

You can lead a man to reason, but you can't make him think.

No amount of restriction on the software design process or programming language can turn bad programmers into good ones. They tried this with languages like Java and Python, and while they are fine languages, bad programmers still write equally horrific code in them. So you are better off optimizing your design process for the good programmers and letting natural selection weed out the bad ones.

Monday, March 23, 2009

Best of Both Worlds

A while ago I spoke with the head of a computer game development company. He explained to me that from an economics perspective, it's really important to keep the perspective on the player as a client of your company:
Imagine a graph of the player's enjoyment over time. The ideal arcade game starts the player with an amazing level of enjoyment, like eating chocolate cake with naked supermodels. Then after a minute or so, the enjoyment drops to zero so they put in another quarter.

Retail games are totally different. You only get their $50 once, meaning you want them playing the game as long as possible. This is so they'll recommend the game to friends. Having an absolutely amazing first minute isn't as important as long term playability and the general amount of content.
His comments stuck with me. A game designer needs to understand why players are supposed to enjoy the game, and whether it's more important to spend resources in one area or another. An arcade style game should focus on eye-candy and general visual "bling", including modern pay-as-you-go online games. The latest flavor of PC and console games only need enough eye-candy to initially attract people, and then get more mileage from more content. No one is happy with a pretty game that's finished in 3 hours.

He implicitly made one other point. Games are a tool for invoking emotional responses. He measured enjoyment, but games have the power to make us laugh and cry. They can frustrate us and make us rejoice. They can make us feel fearful and triumphant. It takes a truly brilliant game to do all of these things.

For me, that game is Thief: The Dark Project, from Looking Glass Studios. And by Thief, I also include the amazing sequel, Thief 2: The Metal Age. If you are unfamiliar with the game, I recommend watching Yahtzee's review at Zero Punctuation. It's delivered in his usual style of sarcasm and obscenities, but it's a very good review.

To summarize, Thief is a game that's the categorical opposite of a standard shooter. Rather than being armed with a dozen different firearms and enough ammunition to kill an entire brigade of bad guys, you play the role of Garrett, the master thief. Garrett is so weak that he's likely to die if he's involved in a fair fight with even one guard. Your whole job is to make sure that you never have to fight fair, ideally by avoiding fights altogether. The missions generally involve breaking into and out of heavily armed facilities, with every level providing a multitude of ways to approach it.

For example, to break into a manor, you might climb up onto the second floor and break a window to get in, sneak around to the back door and pick the lock, or knock out man guarding the front door. Each option has different challenges and benefits. Breaking a window is noisy and sure to attract guards to investigate, but being on the second floor means you're much closer to wherever the lord is keeping his valuables.

As a character, Garrett is a typical anti-hero, something I found refreshingly more believable than the standard do-gooder hero of today's games. Garrett is self-centered, distrusting, arrogant, and apathetic. He just wants to steal enough valuables to retire in style. But he's also extremely clever, and as a character, he is manipulated into both putting the world in danger and saving it through his natural reactions. Garrett only wants to save the world because it implicitly saves his own skin, and he'd rather not put himself in that much danger. But he doesn't have a choice, and the puppeteers in the game know this and take advantage of him because of it. To me, that's a much more believable character than an obscenely powerful special ops soldier who fights evil terrorists Just Because He's That Nice Of A Guy! I won't spoil the story because even after 10 years, it's still excellent.

I found the gameplay intense because it was the first game where I felt genuine fear. I'm not talking about the kind of frightening situations they'd put in a game like Resident Evil, where a zombie pops up out of nowhere and charges at you. That contains all the subtlety of a carnival funhouse. There's a difference between frightening and feeling fear. True fear comes from an impending sense of dread and worry, and that's something a zombie surprise cannot deliver. In Thief, however, you spend the entire game as a weakling. You know that if you make a single mistake, a whole slew of guards can appear and bring a world of hurt. So the entire game is spent wondering if you are hiding in a dark enough shadow, or if you can find a nearby window to jump through if things go downhill.

I'm so impressed that a game could do such a great job of bringing out a variety of emotions. In the space of one minute, you can go from suspense to fear to terror, and then feel extremely pleased with yourself by barely escaping death and finding a well hidden piece of treasure. And never have I played a game where the main character was so despicable, and yet I found myself liking him anyway.

I know that games should either be a lot of fun for a little bit of time, or a little fun for a long time. But somehow Thief manages to be the best of both worlds. The gameplay is always intense, and the story is so good that it hasn't gotten old in the half dozen times I've replayed the game. Somehow, this game embodies the best of both worlds. And while Looking Glass Studios is no more, I hope that someday someone makes another game as good as Thief.

Monday, March 9, 2009

Love Thy Neighbor

Earlier this week, a reader made an interesting comment on my God of Stone post. Bryan analyzed the logic in the post and pointed out that it seemed to argue both in favor of and against revisionism in religion. My argument is actually progressive in nature. I favor revision religion when it's an improvement for humanity and I'm against revisions that are not. For example, removing the moral restrictions on eating pork is a good revision. Praying to a statue of the infant Jesus is not.

As a reminder to newer readers, I am not a Christian anymore, although I was a highly devout one for thirty years. For an explanation of why I left my religion behind, you can read the posts In The Cleft of the Rock, The Man Behind The Curtain, and The Emperor's New God. I am now a humanitarian agnostic. In other words, I'm not sure if God exists, but I believe morality and ethics have meaning even outside the context of God.

While I don't agree with everything the Bible says, I certainly understand the perspective of those that do. Having studied the Bible for decades, I'm convinced that the biblical authors had a similar perspective-- that the true measure of morality and immorality is whether an action helps or hurts humanity. Furthermore, religious authorities in the Bible had no problems revising laws when the new law provided a greater benefit to humanity.

The clearest statement of this philosophy comes from Jeremiah 7. Jeremiah has received a message from God for the people is Israel and soundly chastised them for their idolatry and other immoralities. Then in verse 19, it says:
"But am I the one they are provoking?" declares the Lord. "Are they not rather harming themselves, to their own shame?"
In other words, no amount of immorality can possibly harm God. The whole reason things like idolatry are sinful is that they harm the sinner, by pushing them away from a God that loves them and will bless them with his presence.

This is a crucial argument. Given the premises of the Christian religion, it is absolutely impossible to harm God. Because God loves humanity, he wants them to prosper. Therefore, the only things that God considers sin are those things that work against the humans he loves. So if something doesn't harm any portion of humanity, it cannot be a sin.

Things are only sinful if they harm humanity.

I encourage Christians to stop thinking about God as a random set of likes and dislikes. "God liked Jews and hated pigs. Then later he decided pigs were alright, but homosexuality was still bad." That's just irrational. If you believe in intelligent design as most Christians do, then you need to accept that your God is rational and work from there. God likes stuff that helps humanity and hates stuff that hurts humanity. He might have a better understanding of what "help" and "hurt" mean, but that's as simple as it gets.

When you view the evolution of religion as a gradual improvement on rules that benefit humanity, many stories in the Bible make more sense. For example, in Genesis 9:3-4, Noah has just survived the Ark, and God changes the law of what food humans are allowed to eat. Before the flood, humanity was supposed to be strictly vegetarian, but now God says it's okay to eat animals. Why did God revise his law? Animals were no different than they were before the flood, and now there are fewer of them. Either you think this story is factually true, in which case God must have changed his mind. Or you think this is just a story, so at least the Bible's author has revised the religious law. In either case though, the reason for the revision is clear-- the new law benefits humanity more than the old law did.

God isn't the only important religious figure who revised the Judaeo-Christian religion. Jesus did too, in his Sermon on the Mount. Starting at Matthew 5:17, Jesus says:
Do not think that I have come to abolish the Law or the Prophets; I have not come to abolish them but to fulfill them.
He then proceeds to give nearly a dozen different examples of things people should do different from what the Torah (the law from Moses) instructs or permits. Here are some of these:
  • Insulting people is sinful
  • Looking at a woman lustfully is as bad as adultery
  • Divorcing a woman who has not been unfaithful is sinful
  • You should not seek retribution on people who have offended you
  • Love your enemies
The entire Sermon on the Mount was a revision of the Torah, or at least a reinterpretation. If Jesus said he didn't come to abolish the law and then proceeded to contradict the Torah, then the Torah must not be the law he was talking about. The simplest explanation is that the Torah is merely one interpretation of the laws "Love your God" and "Love your neighbor as yourself". This interpretation can be improved, and that's exactly what Jesus set out to do in his Sermon on the Mount.

If God was willing to revise his own law and Jesus could revise the law God gave to Moses, then everyone who believes the stories in the Bible must logically conclude that revising religious laws can be a good thing, as long as the new law does a better job of loving your God and neighbor. Sometimes the Bible got it wrong and needs to be improved with a good dose of common sense. If Jesus did it and Christians are supposed to act like Jesus, they should not be afraid to apply common sense to their religious text either.

And while I'm not a Christian anymore, this is the reason I believe that every Christian should be pro-gay. There is nothing about homosexuality that is inherently harmful to any human. It makes the couple happy, so logically there's no reason it should offend God. If there are rules against it in the Bible, then maybe those authors just didn't hear from God correctly and people should reconsider whether a ban on homosexuality actually embodies "love your neighbor". It's not at all loving to telling two consenting adults that they cannot marry each other just because they are of the same gender.

Monday, February 23, 2009

Nowhere To Run

Recently I was contacted by the project leader for Q3/PMX. As far as the AI for PMX goes, the plan is similar to BrainWorks: they want a solid AI groundwork for Quake 3 that other mods can easily build off of. As it's been nine years since the initial release of Quake 3, computer processing power and memory storage has greatly increased, so Q3/PMX has some pretty cutting edge objectives for new AI technology. In fact, computers these days are so fast that they can run Quake 3 in a browser. As I understand it, one major portion of PMX will be reworking how Quake 3 AI handles its pathing and routing, which has been a major thorn in my side. If that problem were solved, in my mind there would be one hard problem remaining for artificial intelligence in Quake 3:

Where do you go when there are no items on the level?

This might not seem like a big deal at first glance. But remember that bots use items as the primary motivating factors for deciding where to go. The pathing and routing code will tell you how to get from point A to point B, but all of that is meaningless if you don't know what point B is. The typical strategy is for the bot to pick up the items that help it the most and require the least amount of movement. If the bot can't find any enemies, it will head to the nearest generally useful item and hope a target wanders by. Item placement is the core component of goal selection in BrainWorks.

If you take away the items, everything falls apart.

The bots will simply run after enemies and hope to maintain a reasonable distance. Even a marginally competent player could exploit the bot's predictable behavior.

When two human players are in a level that contains no items, however, they don't get confused at all. Instead they strategically run and hide around the map, using cover to create good shots on the opponent while dodging their return fire. What BrainWorks is missing (and all first person shooter AI bots for that matter) is this dynamic tactical movement. You just don't notice it's missing from BrainWorks because of the item pickup code.

It's very difficult to design AI that can recognize and avoid dangerous areas of terrain while simultaneously taking advantage of opponents in those spots. But it's not impossible. And thanks to nine years of increased processing power and memory, I think it could be a reality in today's games.

Here's the basic algorithm I have in mind. The first objective is to create a "danger map" for the level. The danger map estimates how tactically risky it is to be in each area of the level. Note that "area" needs to be relatively small-- roughly one to two square meters on the ground. Too much larger and the algorithm will get muddied, mistaking good regions for bad. Too much larger and the computation will become prohibitive.

It's far too hard to analyze the geometry of a level to create a danger map, although some simple techniques could be used for a first pass analysis. Instead, the AI could analyze statistical data of players on the level, recording where players are when they got shot and where the attacker was when they made the shot. When this data is combined with statistical tracking of how often players are in a given area, you can create an estimate of how likely you are to get shot in a given region, and how likely you are to shoot someone else. The danger map would be generated using actual statistics from hundreds or thousands of hours of play time on the map.

The likeliness of getting shot is your "danger estimate", and the chance of shooting someone else is the complementary "tactical estimate". Using these values, the AI can evaluate which areas it should definitely avoid (high danger) and which areas it should head towards (high tactics). Note that some areas might be both dangerous and valuable. Standing on top of a pillar gives great vantage for shooting nearby targets, but offers very little cover and escape routes. Bots that were high on health might consider maximizing their tactical position more important than minimizing danger, while a wounded bot would do the reverse.

This all sounds well and good on paper, but if it were actually that easy, it would have been done already. You might be wondering what the catch is.

This algorithm requires an awful lot of training data. If you divide the level into one cubic meter boxes and track danger estimates for all of them, it will take a very long time before you have reasonable estimates for the entire map. There are some tricks that can improve the estimates when less data is available, however.

The basic idea is that if you don't have enough information for the current location, you average together the data for nearby locations. You might not know exactly what position (107,523) looks like, but it's probably similar to the data you have for (110,520). If you have enough other sources of nearby information, you can come up with a reasonably good estimate. The less data you have, however, the further away you have to look for estimates, and the less likely that data is relevant.

Once you have a solid danger map, you just have to teach the bots to avoid dangerous spots and seek out high-value spots. The algorithm could even be expanded to learn which tactically advantageous spots are the best at shooting at targets in a particularly dangerous location. In other words, if the bot realized its target was in a pit, it would look for high ground that's specifically good for shooting into that pit. This might sound more sophisticated than any first person shooter AI currently in existance, and it probably is. But I believe that even simple algorithms can give results far better than the current crop of AI code. This is something that could work on today's computers.

Monday, February 9, 2009

God of Stone

A few weeks ago, I found a Catholic religious pamphlet in a subway car extolling The Infant Jesus of Prague. According to the pamphlet, praying devotions to the statue will cause God to intervene on your behalf and bless you with prosperity. Most non-religious people would regard such claims with mild amusement and derision, but I found myself deeply offended. My issue was not with the mystical claims, but the encouragement to pray to a statue. It goes directly against one of the Ten Commandments, something all Christian denominations (including Catholics) uphold to this day.

The second command says, in abridged form, "do not make or worship any idol". This command was ostensibly from God himself. It doesn't say, "do not worship idols unless they are of me or my messiah". The text is very clear. So when the Catholic church simultaneously says "don't worship any statues" and "give reverence to the Infant Jesus of Prague", they are being logically inconsistent. More than anything, I am offended at the irrationality of the claims. The Catholic church cannot have it both ways. I'm sure they would claim that this is not really idolatry because the statue is of Jesus, the true God. But the actual text in the ten commandments is clear that no physical object should be worshiped, even ones that represent God.

When I went to church as a child, I was taught that the Bible's warnings against idolatry were really a warning against making other things more important than God. In other words, if you value your friends or your grades higher than God, then you've made those things into an idol. While this explanation makes logical sense given the premise that nothing is more important than God, it is fundamentally reinterpretive. When the authors of the Bible warned against idolatry, they really were warning against worshiping stone statues. Now some of the post-exilic writings contain threads reminiscent of the modern reinterpretation, such as the Book of Haggai.

But I wonder how much reinterpretation is too much. Is it really fair to say that the Torah really meant to say, "idolatry is making anything more important than God?" If that statement is true, why does it matter whether the Torah said it or not? The source of a statement doesn't matter as much as the content. It is better to let the ancient writings say what they say, and be honest about our revision. "We allow people to eat pork because there's no good reason to disallow it, even though the Torah says otherwise."

Ancient religions depend on modern reinterpretation to remain relevant today. Or put another way, religions that fail to remain relevant lose followers. I believe this is why there are so many different religions and sects. The religions that have survived for millenniums are those that are most tolerant of revision. Christians and even many liberal Jews have no problems eating pork or letting women wear pants, something that would have shocked Moses. Even one hundred years ago, interracial marriage was outlawed nearly every Christian church in America. I suspect that in another hundred years, the majority of Christian churches will marry gay couples. When a religious law no longer has practical benefits, the religion always revises itself, even if it's a century too late.

This makes me wonder, however, why religions are so willing to revise their laws but so hesitant to revise their gods. The status of legendary religious figures does change slowly over time though. For example, in pre-exilic writings, Satan is portrayed as a henchman of God whose job is to test humanity. After the Babyblonian exile, Satan becomes the adversary of God whose job is to destroy humanity. The clear concept of the messiah doesn't appear in Jewish writings until this time either, although post-exilic rabbis began to interpret the Torah as if it subtly implied a messiah. And the Christian church didn't official decide Jesus was actually God (not just the son of God) until a few centuries after his crucifixion. But in the grand scheme of things, the identity of a religious figure changes much slower than the interpretation of a religious law.

Perhaps the application of ancient laws to modern life produces a stronger discorde than imagining diefic powers operating in Manhattan. The revision of religious figures only seems to occur after the religion's followers as a whole face extreme persecution-- the Babylonian captivity, or Christian oppression under Roman emperors.

From my perspective though, I don't see much of the use of these religious figures. There's a lot of good philosophy in Christianity, and that is worth keeping. But the concepts of God, Jesus, and Satan don't have any real impact on my life. I used to imagine they did in the same way early Jews worshiped idols of Baal. God was my idol of stone, and I realized the good Christian philosophy didn't have anything to do with praying to Jesus. Revising my concept of God might shock modern Christians, but to me it's no different from revising prohibitions on pork. In the end, all religious philosophies evolve to become a set of rules that benefit society as a whole. Dieties aren't required.