Skip to content

A simple gen_server implementing a naive superbowl game

Notifications You must be signed in to change notification settings

gogogarrett/super_bowl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SuperBowl

A simple application to demonstrate how to use the GenServer in an elixir project.

Usage

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!

About

A simple gen_server implementing a naive superbowl game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages