--- a/rps.erl Wed Feb 26 19:05:49 2014 +0900
+++ b/rps.erl Wed Feb 26 19:36:35 2014 +0900
- counter(0, 0, dict:new()).
+ counter(0, 0, dict:new(), dict:new()).
-counter(Plays, Draws, Wins) ->
+counter(Plays, Draws, Wins, Hands) ->
- counter(Plays + 1, Draws + 1, Wins);
- {winner, {_, Winner}} ->
- counter(Plays + 1, Draws, dict:update_counter(Winner, 1, Wins));
+ counter(Plays + 1, Draws + 1, Wins, Hands);
+ {winner, {Hand, Winner}} ->
+ counter(Plays + 1, Draws,
+ dict:update_counter(Winner, 1, Wins),
+ dict:update_counter(Hand, 1, Hands));
- Pid ! {stats, {plays, Plays, draws, Draws, wins, dict:to_list(Wins)}},
- counter(Plays, Draws, Wins)
+ wins, dict:to_list(Wins),
+ hands, dict:to_list(Hands)}},
+ counter(Plays, Draws, Wins, Hands)