Module and Functions
Learn to build a state machine with one state at a time. We will do this in the order that the states follow as the game progresses.
We'll cover the following
Start with a catchall clause
Our goal is to build a whitelist, but we still need to account for all the error cases that won’t match it. A catchall clause helps with this. Therefore, we will define a catchall clause in this section.
Let’s start with a new file at lib/islands_engine/rules.ex
. We define the IslandsEngine.Rules
module in it and alias it as well:
defmodule IslandsEngine.Rules do
alias __MODULE__
end
Get hands-on with 1400+ tech skills courses.