This is historical material “frozen in time”. The website is no longer updated and links to external websites and some internal pages may not work.

Search form

Hello, World

Summary: 
With a brainteaser, Deputy Chief Technology Officer Ed Felten illustrates the wide range of computer science applications.

Though it wasn’t true for President Obama when he became the first president to write a line of code back in December, it’s traditional for the first program a new coder writes to be one that prints out the message “Hello, world.”  From there, the next step for most people is to change the program to say something else, like “Hello, Ed,” and from there to something else.   Coding is exciting: you can decide what is supposed to happen, and the computer will do it…the only limit is your skill and imagination!  I have been coding for almost forty years, and I still can’t get over how cool it is that simple ideas, if combined cleverly, can lead to so many powerful applications.

I started coding around 1977, before the “Hello, world” tradition started.  In those days hardly any kids had access to computers.  I was one of the lucky few.  Today, computers and the skills to use them are available to many more kids, and this Administration is making it a priority to expand access to computer science education to millions of K-12 students across the country.

But computer science is more than just slinging code. Computer science can help us study complex social topics like cooperation, which in turn helps us understand how to help people cooperate more easily and smoothly without even needing to be in the same place. What do I mean? Well, like my colleague and fellow Deputy Chief Technology Officer DJ Patil, I think that a great way to learn about a new topic is with a brainteaser. So here’s mine, on the theme of cooperation.

Alice and Bob are playing a game.  They are teammates, so they will win or lose together.  Before the game starts, they can talk to each other and agree on a strategy. 

When the game starts, Alice and Bob go into separate soundproof rooms – they cannot communicate with each other in any way.  They each flip a coin and note whether it came up Heads or Tails.  (No funny business allowed – it has to be an honest coin flip and they have to tell the truth later about how it came out.)  Now Alice writes down a guess as to the result of Bob’s coin flip; and Bob likewise writes down a guess as to Alice’s flip.

If either or both of the written-down guesses turns out to be correct, then Alice and Bob both win as a team.  But if both written-down guesses are wrong, then they both lose.

The puzzle is this: Can you think of a strategy Alice and Bob can use that is guaranteed to win every time?

To get you started, here is an example of a strategy that doesn’t work: Alice and Bob decide in advance that they will both guess Heads.  This isn’t a guaranteed-winning strategy, because a quarter of the time they will both flip Tails so both guesses will be wrong.  They’ll win 75% of the time, but that isn’t enough – they need to win every time.

It might seem at first like this puzzle is impossible, but don’t give up – there is a solution, which  I’ll reveal in a future post.  In the meantime, watch my Twitter stream @edfelten44 for hints.

Ed Felten is Deputy Chief Technology Officer at the White House Office of Science and Technology Policy.