A simple application to demonstrate how to use the GenServer in an elixir project.
There are currently two team names, :team_one
and :team_two
(can be configured here).
You can simulate the team scoring points with the following API.
iex(1)> SuperBowl.Team.touchdown(:team_one)
:ok
iex(2)> SuperBowl.Team.free_kick(:team_two)
:ok
iex(3)> SuperBowl.Team.two_point_conv(:team_one)
:ok
iex(4)> SuperBowl.Team.field_goal(:team_two)
:ok
To see the current score of the game, you can easily print the results for each team with
iex(1)> SuperBowl.Leaderboard.print_score(:team_one)
{:team_one, 7}
iex(2)> SuperBowl.Leaderboard.print_score(:team_two)
{:team_two, 10}
iex(3)> SuperBowl.Leaderboard.print_score
[team_one: 7, team_two: 10]
After halftime, and fulltime you will get the leaderboards reported to you!