inputs = input('Input:', 's'); % initial state s = 'happy'; while ~strcmp(inputs, 'quit') && ~strcmp(inputs, 'exit') disp(['The Cat was "',s,'", before the "',feeder(s,inputs),'"']); [s, y] = update(s, feeder(s,inputs)); %display output and state disp(['The Cat "',y, '", it is going to be "',s,'"']); if strcmp(y, 'dies') break; end; inputs = input('Input:','s'); end;