The gameplay gif you can see on https://github.com/epidemian/snake is a lie. It was not played by a person, but recorded move-by-move.
The code on record-moves.js was used to first record "player" moves one by one and then the code on replay-moves.js was used to replay them on the game.
The readme-moves.json file contains the