--- a/src/rps_bots.erl Sun Mar 02 22:08:58 2014 +0900
+++ b/src/rps_bots.erl Sun Mar 02 22:10:59 2014 +0900
- Room ! {nickname, self(), "fool"},
- Room ! {nickname, self(), "copycat"},
copycat(Room, hd(get_rules()))
- Room ! {nickname, self(), "gambler"},
Wins = dict:from_list([{C, 0} || C <- get_rules()]),
--- a/src/rps_room.erl Sun Mar 02 22:08:58 2014 +0900
+++ b/src/rps_room.erl Sun Mar 02 22:10:59 2014 +0900
-import(rps3, [get_rules/0, winning_hand/1]).
--record(state, {players=[], choices=[], nicknames=dict:new()}).
+-record(state, {players=[], choices=[]}).
% winner for 3 players is:
% rock, rock, rock -> undefined
lists:foreach(fun(Player) -> Player ! Msg end, Players),
-room(State=#state{choices=Choices, nicknames=Nicknames}) ->
+room(State=#state{choices=Choices}) ->
- {nickname, Who, Nickname} ->
- room(State#state{nicknames=dict:store(Who, Nickname, Nicknames)});
ObjectIsOk = lists:any(fun(X) -> X =:= Hand end, get_rules()),
ChoiceMade = lists:keymember(Who, 2, Choices),