Skip to content

An implementation of the mars rover coding challenge in Rust the way I would love to see it

Notifications You must be signed in to change notification settings

Byron/mars-rover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Goal

Solve the mars rover problem the way I would like it, in Rust. Try to be as idiomatic as possible, and consider the answer the main user value to provide. Thus that and only that MUST be tested, anything else is 'extra', like actually testing for a few things the user can run into.

Getting the answers

Run make answers if your rust installation is at least at v1.26. If you have no rust but docker, run make answers-in-docker.

In any case, you can run all make targets using docker via make interactive-developer-environment-in-docker. Please be warned that initial compilation takes a while.

Features

  • shows correct answers
  • fully streaming with minimal state
  • support for profiling
  • support for benchmarking
  • support for linting
  • interactive developer environment in docker

Benchmark Results

The Rust release binary comes in at 482kb on OSX (stripped). Max-heap is 412kb, and it processes a 7MB file in 196ms. Amount of lines of code is 138, with 33 lines of bash for journey tests.

One Java implementation comes in at 324 lines of implementation code. After some wrangling I was able to run it on the actual benchmark input, even though I couldn't get it to finish the run in any reasonable amount of time.

Another Java implementation had 345 implementation code, and I couldn't run it either as it was not accepting file input.

An implementation from github (https://github.com/max-winderbaum/Mars-Rover-Code-Challenge) used node, with 384 SLOC, while running it consumed 103MB, and... it also didn't finish in a reasonable time so I had to abort it.

And I tried to find a few more, but none were in a state that could run a file :(.

About

An implementation of the mars rover coding challenge in Rust the way I would love to see it

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published