anchor.diff:  -behaviour(gen_fsm).
   
   -export([init/1, 
  -		 state_name/2, 
  -		 state_name/3, 
  +		 no_action/2,
  +		 standing/2,
  +		 moving/2, 
  +		 
  +		 %% TODO implement actions/3
  +		  
   		 handle_event/3, 
   		 handle_sync_event/4, 
   		 handle_info/3, 
  
positive.code: handle_sync_event(Event, From, StateName, StateData) ->
      Reply = ok,
      {reply, Reply, StateName, StateData}.
  
  handle_info(Info, StateName, StateData) ->
      {next_state, StateName, StateData}.
  
negative.code: %% Internal functions
  %% ====================================================================
  
  sense(State) ->
  	%% TODO implement sense phase
  	{next_state, standing, State}.
  
  move(Direction, #state{entity = BcEntity, map = BcMap} = State) ->
  	OriginalBcCollision = bc_entity:to_collision(BcEntity),
  	UpdatedBcCollision = bc_collision:move(Direction, BcCollision),
  	case bc_map:update_collision(BcMap, OriginalBcCollision, UpdatedBcCollision) of
  		ok ->
  			UpdatedBcVertices = bc_collision:vertices(UpdatedBcCollision),
  			UpdatedBcEntity = bc_entity:set_vertices(UpdatedBcVertices, BcEntity),
  			{ok, UpdatedBcEntity};
  		{error, _} = Error ->
  			Error
  	end.
  