# How to create an infinite 2D array list map

**URL:** <https://discourse.processing.org/t/how-to-create-an-infinite-2d-array-list-map/26191>\
**Category:** Coding Questions\
**Created:** [December 13, 2020, 1:32pm UTC](https://discourse.processing.org/t/how-to-create-an-infinite-2d-array-list-map/26191 "2020-12-13T13:32:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [December 13, 2020, 1:32pm UTC](https://discourse.processing.org/t/how-to-create-an-infinite-2d-array-list-map/26191/1 "2020-12-13T13:32:04Z")

</div>

Hi!  
I recently made the game of life. I am interested in how to create infinite map (in all directions)

The arrays would be like (imagine a graph window):

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/ec953843fdeaeb7dd782553df19fec94668c1081.png)

So the arrays would be ++, ±, -+, --.

Would this be a viable solution?

---

<div class="post-metadata">

**Author:** ![SomeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/someone/32/8639_2.png) [@SomeOne](https://discourse.processing.org/u/SomeOne)\
**Post date:** [December 13, 2020, 6:59pm UTC](https://discourse.processing.org/t/how-to-create-an-infinite-2d-array-list-map/26191/2 "2020-12-13T18:59:18Z")

</div>

Infinite map would require infinite memory. If we can assume that most of the cells are empty, i.e. they don’t contain any information, it’s possible to present data as [sparse matrix](http://www.btechsmartclass.com/data_structures/sparse-matrix.html). Game of life algorithm would need to be rewritten, but your not first on this path [https://blogs.mathworks.com/cleve/2012/09/10/game-of-life-part-2-sparse-matrices/](https://blogs.mathworks.com/cleve/2012/09/10/game-of-life-part-2-sparse-matrices/)

Presenting infinite game of life returns to the original problem. How do you present infinite space on a fixed display sizes? I quess you can zoom out.

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [December 13, 2020, 9:13pm UTC](https://discourse.processing.org/t/how-to-create-an-infinite-2d-array-list-map/26191/3 "2020-12-13T21:13:52Z")

</div>

Well, I didn’t really think of that. I am not confident enough in my programming skills to do that yet. Thanks anyway.
