Download:
child 44:8d400faca258
parent 42:82a465d8a5c1
43:a8365c989b1c
Anton Shestakov <engored@ya.ru>, Thu, 06 Mar 2014 19:38:46 +0900
Get win stats by nicknames, not pids.

1 файлов изменено, 3 вставок(+), 1 удалений(-) [+]
src/rps.erl file | annotate | diff | comparison | revisions
--- a/src/rps.erl Mon Mar 03 22:19:53 2014 +0900
+++ b/src/rps.erl Thu Mar 06 19:38:46 2014 +0900
@@ -41,10 +41,12 @@
dict:update_counter(Winner, 1, Wins),
dict:update_counter(Hand, 1, Hands));
{sendstats, Pid} ->
+ Format = fun({Who, W}) -> {rps_nickserv:whois(Who), W} end,
+ WinsByNickname = lists:map(Format, dict:to_list(Wins)),
Pid ! {stats, {
plays, Plays,
draws, Draws,
- wins, dict:to_list(Wins),
+ wins, WinsByNickname,
hands, dict:to_list(Hands)}},
counter(Plays, Draws, Wins, Hands)
end.