Commits

Anton Shestakov committed 44aa20f

Bots must know rules of current room (only rps3 at the moment).

Comments (0)

Files changed (2)

 
 fool(Room) ->
     receive
-        start ->
+        {start, _Rules} ->
             Hand = lists:nth(random:uniform(length(get_rules())), get_rules()),
             Room ! {Hand, self()},
             fool(Room);
 
 copycat(Room, Hand) ->
     receive
-        start ->
+        {start, _Rules} ->
             Room ! {Hand, self()},
             copycat(Room, Hand);
         {winner, {NewHand, _}} ->
 
 gambler(Room, Wins) ->
     receive
-        start ->
+        {start, _Rules} ->
             F = fun({_, A}, {_, B}) -> A =< B end,
             {Hand, _} = hd(lists:sort(F, dict:to_list(Wins))),
             Room ! {Hand, self()},
     end.
 
 room(Players) when is_list(Players) ->
-    lists:foreach(fun(Player) -> Player ! start end, Players),
+    lists:foreach(fun(Player) -> Player ! {start, rps3} end, Players),
     room(#state{players=Players});
 
 room(#state{players=Players, choices=Choices}) when length(Players) =:= length(Choices) ->