Skip to content

Latest commit

 

History

History
9 lines (7 loc) · 470 Bytes

README.md

File metadata and controls

9 lines (7 loc) · 470 Bytes

React snake game

Image alt

Implementation notes:

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