Modeling Snake Game

  • I have been trying to make the snake game in elm.

  • The keyboard response was not as smooth as I wanted. So I tweaked the code to respond to the change in direction immediately on next frame.

  • As a side effect, sometimes snake would move twice. This was difficult to trace, but I realized that the auto step counter had to be reset, if a move was made by keypress.

  • Handling this case made the update code even more complex to comphrehend.

  • Please suggest any changes, that could simplify the update.
    Or perhaps a change in the model to reflect the intent.
    The model is currently flat, and I am finding it difficult to break it down.

Ellie link: https://ellie-app.com/9zwx83Y4V7za1
GitHub: https://github.com/jigargosar/snake-kata/blob/master/src/Kata4.elm

GitHub links to 404. Is that a private repo?

My bad, made public.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.