Best data structure for an immutable persistent 3D grid

后端 未结 1 1017
北恋
北恋 2021-02-05 23:49

I\'m experimenting with writing a game in a functional programming style, which implies representing the game state with a purely functional, immutable data structures.

1条回答
  •  无人及你
    2021-02-06 00:13

    I'd try an octtree. The boundary coordinates of each node are implicit in structure placement, and each nonterminal node keep 8 subtree but no data. You can thus 'unioning' to gain space.

    I think that Immutable and Unbounded are (generally) conflicting requirements.
    Anyway... to grow a octtree you must must replace the root.

    Other requirement you pose should be met.

    0 讨论(0)
提交回复
热议问题