Anton Shestakov <engored@ya.ru>, Sun, 02 Mar 2014 17:39:33 +0900
Use state record for room.
src/rps_bots.erl
Permissions: -rw-r--r--
-import(rps3, [get_rules/0]). -export([fool/0, copycat/0, gambler/0]). Hand = lists:nth(random:uniform(length(get_rules())), get_rules()), copycat(Room, hd(get_rules())) {winner, {NewHand, _}} -> Wins = dict:from_list([{C, 0} || C <- get_rules()]), F = fun({_, A}, {_, B}) -> A =< B end, {Hand, _} = hd(lists:sort(F, dict:to_list(Wins))), gambler(Room, dict:update_counter(Hand, 1, Wins))