anchor.diff:  -behaviour(gen_server).
   
   %% API
  --export([start_link/1]).
  +-export([start_link/2]).
   
   %% gen_server callbacks
   -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
  
positive.code: 
  handle_request({data, RawData}, #state{socket=Socket, player=Player} = _State)  ->
    try
  	Data = string:strip(string:strip(RawData, right, $\n), right, $\r),
  	Command = list_to_atom(Data),
  	{X, Y} = sm_player:move(Player, Command),
  	Response = ["You moved to ", X, ", ", Y, "\r\n"],
  	gen_tcp:send(Socket, Response),
  	gen_tcp:send(Socket, "> "),
  	{ok}
    catch
  	error:Reason ->
  	    {error, Reason}
    end.
  		    
  
negative.code: handle_info({tcp, Socket, Bin}, #state{socket=Socket, player=_Player} = State) ->
      % Flow control: enable forwarding of next TCP message
      inet:setopts(Socket, [{active, once}]),
      handle_request({data, Bin}, State),
      {noreply, State};
  
  handle_info(_Info, State) ->
    {noreply, State}.
  