Conditions and Dictionaries17 Oct 2011
Last week I was involved in some new employee code reviews and pairing interviews. Since most people that apply to ThoughtWorks do our Mars Rover problem, I decided that I should probably give the problem a try. The solution is pretty simple, which is probably why most people select this problem. I happened to be in a programming mood at the time, so I decided to make the problem a little more difficult.
Could I write a solution without an IF statement?
It turns out that I can and the results were very interesting. Here is the first cut of my spin left method before the change over.
Here is another deviation with if statements, because you know... switches are smelly.
Then here is what I came up with when trying to remove all my conditions.
Edit: gist's were deleted