Needs code review for class implementation
A couple of issues I found or suggestions I have:


avoid unnecessary or redundant comments (like # initialize values within initialize)
use symbols for your commands and facings
don't use upper case letters in your variable names (pos_x or just x instead of pos_X)
no need to check for != nil, you can simply do params[0] &amp;&amp; params[1] &amp;&amp;params[2]
I'd convert simple ifs to use the ternary operator instead: is_valid_position ? @robot = @r : Game.new
find a better name for @r
I'm not sure why you're using instance_variable_get instead of just @robot.pos_X


Try to refactor your longer methods. Take setup as example, personally, I'd like it to look somewhat like this:

def setup(command)
  begin
    params = get_params(command)
  rescue ParamsInvalidError
    restart
  end

  new_robot(params)
  restart unless is_valid_position?
end