An unofficial guide to the Facebook Engineering Puzzles

David Eisenstat


RIP, puzzle robot

Facebook has shut down the robot for good. Since the links to the puzzle descriptions no longer work, this guide is of historical interest only.

How to play

The list of puzzles is here.

Conventional puzzles

The robot has been down for months. No one knows when service will be restored.

In one of ten supported languages, write a program to be evaluated on a server maintained by Facebook (“the robot”). I have specific instructions for each language: C, C++, Erlang, Haskell, Java, OCaml, Perl, PHP, Python, Ruby.

You will find most of these puzzles difficult unless you have studied algorithms at the undergraduate level. Please do not discuss algorithms in the context of specific puzzles!

Thrift puzzles

The Thrift-puzzle server has been down for months. No one knows when service will be restored.

In any language supported by Thrift, write a program to make your computer interact with the Thrift-puzzle server, which is maintained by Facebook. When you solve a puzzle, winGame() will return a string like simonsays(0123456789abcdef0123456789abcdef). Receive credit for your solution by sending an email to puzzles@fb.com whose subject is exactly that string. You are not required to attach your code, but the Puzzle Master would appreciate it. You should receive a reply within an hour or so.

To get started with Thrift, install the latest stable release and modify one of the clients in the tutorial directory to solve simonsays. Ignore the warnings about field keys not being specified.

Hidden puzzles

Discover a secret keyword and send an email to 1051962371@fb.com whose subject is exactly that keyword. There are two puzzles with secret keywords. Clues can be found on the Puzzle Master page.


Troubleshooting

Bounce message or no reply

Could not be understood

Conventional puzzles

Could not be built/run

The robot runs make and ant and then checks the working directory for a regular file whose name is the puzzle keyword. “Could not be built/run” means that no such file exists. If such a file does exist but is not executable, the robot makes it executable.

Found some bugs

“Found some bugs” means that your program could be built (see above) but failed to write the unique correct output within the time allotted.

At wits’ end

Use meepmeep to ask the robot yes/no questions. To determine, for example, whether the robot has conio.h, send

#!/bin/sh
if [ -f /usr/include/conio.h ]; then printf 'Meep meep!\n'; fi

This submission is incorrect, so the robot does not have conio.h. Twenty questions is a slow but effective debugging strategy.

Thrift puzzles

Connection problems

Timeouts

winGame returns a string with characters that are not printable 7-bit ASCII

Does not match a known winning session

Getting help


Robot wish list


Frequently asked questions

Why is my favorite programming language unsupported?

Facebook has chosen to support only those languages in use at Facebook.

Why is the robot’s software so old?

Per the Puzzle Master, the robot’s security configuration makes upgrading difficult.

Has puzzle X been solved in language Y?

Good algorithms will be successful in any of the supported languages.

Why does email to -21779453@fb.com bounce?

The correct interpretation of {0xFACEB00C>>2 in decimal}@fb.com is 1051962371@fb.com. The Puzzle Master intended that 0xFACEB00C evaluate to 4207849484, but in Java, which lacks unsigned types, 0xFACEB00C evaluates to -87117812. (-87117812 is the integer whose 32-bit signed two’s complement representation is identical to the 32-bit unsigned representation of 4207849484.) Since the Java standard defines >> to be an arithmetic right shift, the value of 0xFACEB00C>>2, which is -21779453, has undergone sign extension and is thus wrong.

Why doesn’t the robot reply instantly/with more details?

Per the Puzzle Master, the robot sends infrequent/vague replies to prevent puzzlers from learning about its test cases and to discourage malicious users from examining its security configuration.

Will the robot grade two submissions made within an hour of one other?

Yes; each submission requires its own email. Please be mindful of the fact that the robot is a shared resource.

Can I make submissions for puzzles that I have already solved?

Yes.

Who are you? Are you the Puzzle Master?

I, David Eisenstat, am a PhD candidate in the Computer Science Department at Brown University with no previous or current relationship to Facebook. The Puzzle Master works at Facebook and wishes to remain anonymous.


Puzzles

Hors d’œuvre difficulty

hoppity

Official description

Tests not available yet.

hoppity_test.zip (instructions)


meepmeep

Official description

Tests not available yet.

meepmeep_test.zip (instructions)


Snack difficulty

liarliar

Official description

Tests not available yet.

liarliar_test.zip (instructions)


breathalyzer

Official description

Tests not available yet.

breathalyzer_test.zip (instructions) (with thanks to Raluca Musăloiu-E.)


gattaca

Official description

Tests not available yet.

gattaca_test.zip (instructions)


simonsays (Thrift)

Official description

Thrift-puzzle server


dancebattle

Official description

Tests not available yet.

dancebattle_test.zip (instructions)


smallworld

Official description

Tests not available yet.

smallworld_test.zip (instructions)


usrbincrash

Official description

Tests not available yet.

usrbincrash_test.zip (instructions)


Meal difficulty

rushhour (Thrift)

Official description

Thrift-puzzle server


battleship (Thrift)

Official description

Thrift-puzzle server


fridgemadness

Official description

Tests not available yet.

fridgemadness_test.zip (instructions)


peaktraffic

Official description

Tests not available yet.

peaktraffic_test.zip (instructions)


swarm

Official description

Tests not available yet.

swarm_test.zip (instructions)


Buffet difficulty

dinoisland (Thrift)

Official description

Thrift-puzzle server


sophie

Official description

Tests not available yet.

sophie_test.zip (instructions)


facebull

Official description

Tests not available yet.

facebull_test.zip (instructions)


Retired

bagthebanner (Thrift)

bagthebanner, a game of capture the flag with robots, was the first Thrift puzzle. It was incompatible with common firewall settings and offered no viable defensive strategies. dinoisland is its replacement.


Using my test cases


Version history


© 2009–2011 David Eisenstat