Download:
child 11:9dd5bb0a4c0c
parent 9:4b4d65b99174
10:aa2a22dbe1e7
Anton Shestakov <engored@ya.ru>, Wed, 26 Feb 2014 01:46:12 +0900
Use lists:keymember for testing if player has already made his choice.

1 файлов изменено, 1 вставок(+), 1 удалений(-) [+]
rps.erl file | annotate | diff | comparison | revisions
--- a/rps.erl Wed Feb 26 01:38:26 2014 +0900
+++ b/rps.erl Wed Feb 26 01:46:12 2014 +0900
@@ -93,7 +93,7 @@
receive
{Object, Who} ->
ObjectIsOk = lists:any(fun(X) -> X =:= Object end, get_rules()),
- ChoiceMade = lists:any(fun({_, Player}) -> Player =:= Who end, Choices),
+ ChoiceMade = lists:keymember(Who, 2, Choices),
case ObjectIsOk andalso not ChoiceMade of
true ->
room(Players, [{Object, Who}|Choices]);