anchor.diff:           terminate/3,
            code_change/4]).
   
  --record(state, {results}).
  +-record(state, {results, turn, round, dice, kept, score}).
   
   name() -> yahtzee.
   
  
positive.code: start_link() ->
      gen_statem:start({local, name()}, ?MODULE, [], []).
  
  status() ->
      gen_statem:call(name(), status).
  
  stop() ->
      gen_statem:stop(name()).
  
  %%%============================================================================
  %%% gen_statem callbacks
  %%%============================================================================
  init([]) -> 
      Data = #state{results = []},
      {ok, standby, Data}.
  
  terminate(_Reason, _State, _Data) -> ok.
  
negative.code: standby(cast, _Event, _Data) ->
      {keep_state_and_data, []};
  
  standby({call, From}, {bet, _Who, Bet}, Data) ->
      Reply = {ok, {bet, Bet}},
      NewData = Data#state{results = [], turn = 1, round = 1, dice = [1,1,1,1,1], kept = []},
      {next_state, player_roll, NewData, [{reply, From, Reply}]};
  
  standby({call, From}, status, Data) ->
      Reply = {ok, standby},
      {keep_state, Data, [{reply, From, Reply}]};
  