This code was originally created by Stefan Rapeanu-Andreescu. All credit to him.
I don't know all the details about this program, I just modify it to be used in a bigger screen (16x16 LEDs) and to be controlled using the encoder.
You have to be gentle with the encoder, every step is a move.
When the snake reaches the end of the LED array, it emerges again on the opposite side