--- a/src/rps_rules.erl Sat Mar 08 23:45:03 2014 +0900
+++ b/src/rps_rules.erl Sat Mar 08 23:46:38 2014 +0900
% rock, paper, paper -> paper
% rock, rock, paper -> paper
-winning_hand(Hands, State=#ruleinfo{}) ->
+winning_hand(Hands, Ruleinfo=#ruleinfo{}) ->
HSet = sets:from_list(Hands),
- Loses = dict:fetch(Hand, State#ruleinfo.loses),
+ Loses = dict:fetch(Hand, Ruleinfo#ruleinfo.loses),
case sets:is_disjoint(sets:from_list(Loses), HSet) of
-why(H1, H2, State=#ruleinfo{}) when is_atom(H2) ->
- atom_to_list(dict:fetch({H1, H2}, State#ruleinfo.why));
+why(H1, H2, Ruleinfo=#ruleinfo{}) when is_atom(H2) ->
+ atom_to_list(dict:fetch({H1, H2}, Ruleinfo#ruleinfo.why));
-why(H1, Hands, State=#ruleinfo{}) when is_list(Hands) ->
- F = fun(H2) -> why(H1, H2, State) ++ " " ++ atom_to_list(H2) end,
+why(H1, Hands, Ruleinfo=#ruleinfo{}) when is_list(Hands) ->
+ F = fun(H2) -> why(H1, H2, Ruleinfo) ++ " " ++ atom_to_list(H2) end,
atom_to_list(H1) ++ " " ++ string:join(lists:map(F, Hands), ", ").