Quote:
Originally Posted by just_grindin
Do you have more material I could read or projects to provide more enlightenment?
I know my example is contrived to fit with the turtle game but I thought they fairly reflected my understanding of state. Admittedly the acceleration part was a stretch but the example seemed legitimate.
I think your explanation is very good.
I generally think of "state" as "destructive" and "stateless" as a "film."
In state would destroy the initial position and each successive position.
In stateless, move() would be feeding a list of pre-computed values into turtle, and turtle[0] would show the initial position, etc. This would allow you to "rewind" the path of the turtle.
I think your ideas about how to do it, computing accelaration on the fly, and considerations of memory, are great insights.
Although the programmer didn't use state, the implementation of the board itself and the movement is likely stateful, as the interaction of the outside world forces some change in the environment, though isolated to that section of the world.
I always say the distinction is rather hand-wavy. there is a sense of time / state in each approach, but the simplest distinction is, if you can't use variable substitution and guarantee a result of a function for each step of the system, then you are in state, if you can, then you are stateless.
In any case, I mostly rewrote what you wrote.