diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2024-02-23 07:08:18 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2024-02-23 07:08:18 +0100 |
commit | 5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e (patch) | |
tree | 982ca2e7f9ac4e8c350dfb5c4f60bcfdfff5afaf /learn-you-some-erlang/processquest/apps/processquest-1.0.0/src/pq_stats.erl | |
parent | 05ae56e5e89abf2993f84e6d52b250131f247c35 (diff) | |
download | erlang-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/processquest/apps/processquest-1.0.0/src/pq_stats.erl')
-rw-r--r-- | learn-you-some-erlang/processquest/apps/processquest-1.0.0/src/pq_stats.erl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/learn-you-some-erlang/processquest/apps/processquest-1.0.0/src/pq_stats.erl b/learn-you-some-erlang/processquest/apps/processquest-1.0.0/src/pq_stats.erl new file mode 100644 index 0000000..379f5e9 --- /dev/null +++ b/learn-you-some-erlang/processquest/apps/processquest-1.0.0/src/pq_stats.erl @@ -0,0 +1,19 @@ +%%% Rolls dice to generate statistics or level increases for a character +-module(pq_stats). +-export([initial_roll/0, roll/0]). + +%% First roll, when setting the stats up for the first time +initial_roll() -> + [{charisma, roll(3)}, + {constitution, roll(3)}, + {dexterity, roll(3)}, + {intelligence, roll(3)}, + {strength, roll(3)}, + {wisdom, roll(3)}]. + +%% Rolls a single die. Used when leveling up +roll() -> roll(1). + +%% Rolls Num 6-faced dice +roll(Num) -> + lists:sum([random:uniform(6) || _ <- lists:seq(1,Num)]). |