Mars Rovers I: The Problem
The Problem
When I read “The Problem Statement” in Aditya Athalye’s A Clojure view of “Mars Rovers” (which see), I had the impulse to drop whatever I was doing and write my own solutions before being exposed to any spoilers from his own answer. Though that grid was not infinite, I was still nerd-sniped.
According to him, it’s “one of those evergreen software design interview questions” and “perhaps second only to FizzBuzz” and “available all over the internet”. And yet, I hadn’t seen it before — and, it follows, hadn’t attempted to solve it.
Simple as it might be, I feel unreasonably attracted to this sort of problem. I’m not sure why. Maybe it has something to do with it lending itself to purely functional approaches. Maybe it’s because it begins and ends with a string, and I like dealing with plain text. Maybe something else. In the end, it amuses me, and I end up diving into it.
So I reread the instructions, closed the tab, opened a *scratch* buffer, and paused to ponder the problem. My initial intention was to do it only in Clojure. Unsurprisingly, I couldn’t resist inviting Emacs Lisp and Bash to the party later on.
But first things first: before writing any code, I thought about design.
(If you feel like solving this problem yourself, stop reading NOW and come back after you’re satisfied with your solution(s). My own spoilers start next, in part II.)
The Series
Mars Rovers I: The Problem
Mars Rovers II: The Design
Mars Rovers III: The Solutions — Clojure
Mars Rovers IV: The Solutions — Emacs Lisp
Mars Rovers V: The Solutions — Bash
📆 2026-W16-6📆 2026-04-18