We’ll be running this friendly programming challenge continuously for hopefully many months or years. Keep your submissions coming!

At Esper we’re always looking to challenge ourselves in new ways. Some of us find that writing programs and running them is more fun than a bunch of other activities, including but not limited to watching tv and talking to people; although we sometimes do. Anyway. Maybe your current task is a bit boring and you’re looking for new ways to procrastinate. Seek no further, we’ve created this little programming challenge just for you. If you succeed, you’ll win this one amazing mug, which undoubtedly will make all your friends and colleagues jealous of your advanced computer hacking skills.



This is one mug, not two. Sorry, we will no longer ship the mug to destinations outside of the United States. We’re really sorry and we’re working on an alternate prize we can send to everyone.


You must write a program for a robot that navigates a closed maze in search for letters that were printed on the floor of the maze. The solution consists of the list of all letters, ordered alphabetically. The letters are capitals (A-Z) and the same letter may exist in multiple locations.


The solution for the following maze is AABQ:

#   A   #   #
# ## ## # # #
# Q# #   B  #
#  #A# # ####

# symbols indicate walls, which are illegal positions. Your robot can navigate on all other cells vertically or horizontally but not diagonally. You can see the 4 neighbors cells (up, down, left, right) around your current cell.

The initial position of the robot can be any non-wall cell (empty or letter), inside the maze.

Navigation API

Your program will read cell information from stdin, then write a command on stdout, and loop.

Cell information is given as one line of 5 characters indicating the type of the current cell and the type of each of the neighbor cells in the following order: current, up, down, left, right. In the example, if the current position is the position of the letter Q, cell information will be given as:

Q#  #

A command is either one of the 4 navigation commands indicating which neighbor cell to move to (U: up, D: down, L: left, R: right) or the key for escaping the maze starting with the K prefix, e.g. KAABQ which terminates the game. Commands are terminated by a newline character (LF).

An attempt to move into a wall or giving a wrong key terminates the life of the poor robot.

Here is a very simple maze:


A successful session for this maze, assuming a start position on cell marked with A is:

 input: A###B
output: R
 input: B##A#
output: KAB


The number of moves is limited to at most twice the number of moves required by our reference solution. This limit as well as the size of the maze remain undisclosed (edited 2015-03-17).

Your program may not consult files or network resources other than stdin and stdout as specified above. It must consist in human-readable source code written by yourself. We will build it and run it on Ubuntu 14.04 (64 bits). Please provide:

  • the list of packages needed to build and run your solution or your best guess
  • a shell script to build your solution in one shot
  • the command to run your solution


Make sure your solution is successful on the sample mazes on this page, and make sure to flush stdout after printing each command when your program runs non-interactively.


Please send us your solution to programming@esper.com. All successful entries win the exclusive trophy mug!

About us

We are Esper, a still small company based in the San Francisco Bay Area, and we’re building a service to empower executives with professional executive assistants 24/7. If you share our passion and standards in software engineering and want to make a difference in the world, you should talk to us!


  1. Edit: The number of moves is now limited to at most twice the number of moves required by our reference solution. This limit as well as the size of the maze remain undisclosed.


  2. Edit: Due to prohibitive shipping costs, we stopped shipping the mug to destinations outside of the United States. We’re working on an alternate prize for our international participants.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s