Anton Shestakov <engored@ya.ru>, Mon, 03 Mar 2014 15:37:24 +0900
Each room has its own set of rules.
src/rps_bots.erl
Permissions: -rw-r--r--
-export([fool/0, copycat/0, gambler/0]). rps_nickserv:nick(self(), "fool"), Hands = apply(Rules, get_rules, []), Hand = lists:nth(random:uniform(length(Hands)), Hands), rps_nickserv:nick(self(), "copycat"), copycat(Room, hd(apply(Rules, get_rules, []))) {winner, {NewHand, _}} -> rps_nickserv:nick(self(), "gambler"), R = apply(Rules, get_rules, []), Wins = dict:from_list([{C, 0} || C <- R]), F = fun({_, A}, {_, B}) -> A =< B end, {Hand, _} = hd(lists:sort(F, dict:to_list(Wins))), gambler(Room, dict:update_counter(Hand, 1, Wins))