Spiral Iterators

We have had spiral iterators for hex grids for a while now: a method that lazily returns points (via an IEnumerable) in a spiral around a given point (skipping over points not in the grid). In Grids 1.10, we added them for Rect and Diamond grids too.

Although there are a few games in which these are directly useful, they are a bit too specific for use in arbitrary rule logic – we provide only anti-clockwise spirals, and they always expand to the next ring in a specific direction.

But spiral iterators are useful in other contexts too:

  • It can be used as a cheap type of breadth first iteration which can significantly speed up certain algorithms (in certain cases :P).
  • It can be used for distribution (for example, of enemies) instead of using colorings.

[button url=”https://gamelogic.co.za/2015/01/12/grids-1-10-is-out/” size=”large”]Find out more about Grids 1.10[/button]

[button url=”https://gamelogic.co.za/grids/buy/” size=”large”]Buy Grids now[/button]

Scroll to Top