Skip to content

Instantly share code, notes, and snippets.

@patrickcarver
patrickcarver / gist:9c3de203a355883ed83715ab8a4ceec9
Last active December 11, 2020 23:20
Creating a map of seats for Advent of Code Day 11 in Elixir
A few notes:
* The `lines` parameter is a list of text like [".L.L", "LLL.", etc.].
* Nothing special with starting the indexes at one, just a preference I have.
* The `parse_square('#')` pattern match is handy in debugging, but not needed for the initial input.
```elixir
# lines is a list of text like [".L.L", "LLL.", etc.]
def create_grid(lines) do
for {line, y} <- Enum.with_index(lines, 1),
{square, x} <- Enum.with_index(String.graphemes(line), 1),

Keybase proof

I hereby claim:

  • I am patrickcarver on github.
  • I am patrickcarver (https://keybase.io/patrickcarver) on keybase.
  • I have a public key ASBgGZfY-G_ra6rr6-YmaQ1f-d9K3eBvfYdS1TOsgKwbGgo

To claim this, I am signing this object: