- Doubly linked list stores snake coordinates.
- Pros: doubly linked list easily implements "sliding window" pattern (pop last element and push new one) and takes O(1) time.
- Cons: Searching of crossing a snake with itself or with game borders runs with order O(n).
- Circular array loop is implemented in the "easy" game mode.
amozalev/react-snake-game
React snake game using doubly linked list to store snake coordinates
TypeScript