An open API service indexing awesome lists of open source software.

https://github.com/ericdude4/matrix_traversal

Traverse through an n by n matrix in a spiral pattern, outputting coordinates at each location
https://github.com/ericdude4/matrix_traversal

Last synced: 10 months ago
JSON representation

Traverse through an n by n matrix in a spiral pattern, outputting coordinates at each location

Awesome Lists containing this project

README

          

# Matrix traversal

`cd` into this directory and run in an interactive elixir session with `iex -S mix`

```elixir
Matrix.traverse(5)
> (0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (4, 1), (4, 2), (4, 3), (4, 4), (3, 4), (2, 4), (1, 4), (0, 4), (0, 3), (0, 2), (0, 1), (1, 1), (2, 1), (3, 1), (3, 2), (3, 3), (2, 3), (1, 3), (1, 2), (2, 2), finish
```