aboutsummaryrefslogtreecommitdiff
path: root/learn-you-some-erlang/curling_scoreboard_hw.erl
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-02-23 07:08:18 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2024-02-23 07:08:18 +0100
commit5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e (patch)
tree982ca2e7f9ac4e8c350dfb5c4f60bcfdfff5afaf /learn-you-some-erlang/curling_scoreboard_hw.erl
parent05ae56e5e89abf2993f84e6d52b250131f247c35 (diff)
downloaderlang-workshop-5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e.tar.gz
erlang-workshop-5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e.tar.bz2
erlang-workshop-5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e.tar.xz
erlang-workshop-5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e.zip
wip
Diffstat (limited to 'learn-you-some-erlang/curling_scoreboard_hw.erl')
-rw-r--r--learn-you-some-erlang/curling_scoreboard_hw.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/learn-you-some-erlang/curling_scoreboard_hw.erl b/learn-you-some-erlang/curling_scoreboard_hw.erl
new file mode 100644
index 0000000..adfe4ab
--- /dev/null
+++ b/learn-you-some-erlang/curling_scoreboard_hw.erl
@@ -0,0 +1,19 @@
+-module(curling_scoreboard_hw).
+-export([add_point/1, next_round/0, set_teams/2, reset_board/0]).
+
+%% This is a 'dumb' module that's only there to replace what a real hardware
+%% controller would likely do. The real hardware controller would likely hold
+%% some state and make sure everything works right, but this one doesn't mind.
+
+%% Shows the teams on the scoreboard.
+set_teams(TeamA, TeamB) ->
+ io:format("Scoreboard: Team ~s vs. Team ~s~n", [TeamA, TeamB]).
+
+next_round() ->
+ io:format("Scoreboard: round over~n").
+
+add_point(Team) ->
+ io:format("Scoreboard: increased score of team ~s by 1~n", [Team]).
+
+reset_board() ->
+ io:format("Scoreboard: All teams are undefined and all scores are 0~n").