%CATLAB4 - the cat for lab 4

%initialize state
state = 'happy';

%infinite loop
while 1
    %prompt user for input
    str = input('Enter absent, pet, feed, or time passes: ','s');
    
    %quit if 'quit' or 'exit'
    if strcmp(str,'quit') break; end
    if strcmp(str,'exit') break; end
    
    %call possibleUpdate
    result = chooserow(possibleChooseUpdate(state, str));
    state = result{1};
    
    %print output
    disp(result{2})
    
    %quit if the cat dies
    if strcmp(state, 'dead') break; end
end
