Download:
child 30:efdf4524dafd
parent 28:44aa20fdf779
29:0f29304f36f4
Anton Shestakov <engored@ya.ru>, Sun, 02 Mar 2014 22:08:58 +0900
Backed out changeset 44aa20fdf779: let's not change rules each round.

2 файлов изменено, 4 вставок(+), 4 удалений(-) [+]
src/rps_bots.erl file | annotate | diff | comparison | revisions
src/rps_room.erl file | annotate | diff | comparison | revisions
--- a/src/rps_bots.erl Sun Mar 02 18:00:14 2014 +0900
+++ b/src/rps_bots.erl Sun Mar 02 22:08:58 2014 +0900
@@ -16,7 +16,7 @@
fool(Room) ->
receive
- {start, _Rules} ->
+ start ->
Hand = lists:nth(random:uniform(length(get_rules())), get_rules()),
Room ! {Hand, self()},
fool(Room);
@@ -37,7 +37,7 @@
copycat(Room, Hand) ->
receive
- {start, _Rules} ->
+ start ->
Room ! {Hand, self()},
copycat(Room, Hand);
{winner, {NewHand, _}} ->
@@ -58,7 +58,7 @@
gambler(Room, Wins) ->
receive
- {start, _Rules} ->
+ start ->
F = fun({_, A}, {_, B}) -> A =< B end,
{Hand, _} = hd(lists:sort(F, dict:to_list(Wins))),
Room ! {Hand, self()},
--- a/src/rps_room.erl Sun Mar 02 18:00:14 2014 +0900
+++ b/src/rps_room.erl Sun Mar 02 22:08:58 2014 +0900
@@ -26,7 +26,7 @@
end.
room(Players) when is_list(Players) ->
- lists:foreach(fun(Player) -> Player ! {start, rps3} end, Players),
+ lists:foreach(fun(Player) -> Player ! start end, Players),
room(#state{players=Players});
room(#state{players=Players, choices=Choices}) when length(Players) =:= length(Choices) ->