This was one of my first experiments with attempting to build and interact with a tile map on canvas. Refresh the page to see a different generation.

This tile map is an early version of a re-written tile map on github. I got the idea from linked lists, although I'm not sure how appropriate or effective the structure is in more complex scenarios. The structure is backed by a 2 dimensional array (matrix) and looks like this:


            null           null
             ^              ^
             |              |
             +              +
         +------+       +------+
         |      |<-----+|      |
null <---+| root |       |      |+---> null
         |      |+----->|      |
         +------+       +------+
           +  ^           +  ^
           |  |           |  |
           v  +           v  +
         +------+       +------+
         |      |<-----+|      |
null <---+|      |       |      |+---> null
         |      |+----->|      |
         +------+       +------+
             +              +
             |              |
             v              v
            null           null

  

If you have any thoughts, suggestions, feedback, please comment!