Memoize legalNeighbours, need to do the same for the canTerminateInStepsRemaining
code tidy up
organize imports
Mockito not easy to stub memoization so  made a test double instead
ValueInFunctionParam takes a param representing a primitive type
Starting to make factory for param values that uses accumulator
The accumulator loop also returns the scope
After the createSeq loop we can optionaly copy back the acc length into any val in the Scope, or if no then returns scope unchanged
Rename and split out a val to make the return more readable