function output = feeder (state, input) %feed when 1 or time passes if ((strcmp(input, '1')||strcmp(input,'time passes'))... && strcmp(state, 'hungry') ) output='feed'; %time passes when input is 1 and state != hungry else if (strcmp(input, '1')) output='time passes'; %all other inputs are fine, let them be else output=input; end end