Elixir Game of Life

    I've been feeling nostalgic for the days when I was coding in Elixir, since I've mostly been coding in C# and JavaScript lately. Elixir is still one of my favorite languages, and I think it's a lot of fun to code in. I decided to revisit a project I built Snow Colleges 2019 Coding Competition. The competition was to build a solver for Conway's Game of Life, and the solver that could find a certain amount of generations the quickest. Since Elixir is such a great language for writing multi-threaded programs, I built a fun solver and took third in the competition.

    The project had to connect to an API that would send the starting board and track each solver's progress (I also built a front-end way to view all the players progress which was used in the competition. The code is in C# and asp.net, you can check it out here!), so one file in the project is entirely just for handling the HTTP requests, while the actual solver is relatively small. HttPoison was used to handle HTTP requests, and it would send the progress as it solved the board or an update showing it's still active every second. 

    The actual solving is simple when I explain it in words; we create a thread for each cell that checks the amount of surrounding live cells, and then we find out whether that cell is going to live or die, and return the result. The project is a great example of the wide variety of tools Elixir has in its toolbox;  Enum functions like filter, map, counter, member?, uniq, concat, etc, we use pattern matching on functions to determine results, and even structs to track the board and live cells. 

    If you work for a company coding in Elixir, reach out! I really want a job coding in Elixir.

    You can check out the code here!


Popular posts from this blog

API's in C#

Using WebRTC to build a videophone in React and TypeScript

Reviewing WPF and MVVM