Skip to content

Instantly share code, notes, and snippets.

View shadybotros's full-sized avatar

Shady Botros shadybotros

View GitHub Profile
@shadybotros
shadybotros / rover.js
Last active February 1, 2019 16:20
An attempt to solve the Mars Rover Kata (https://codurance.com/2017/11/16/katas-for-functional-calisthenics/#marsroverkata), assuming an unlimited world and without wrapping. Try it in the Ramda REPL (https://ramdajs.com/repl/).
const moveRover = curry((initialPosition, commands) => {
return commands.reduce(moveRoverOnce, initialPosition);
});
const moveRoverOnce = (position, command) => pipe(
mapToInternalFormat,
rotate(command),
move(command),
mapBack
)(position);