% %decide whether to move south, move, mark as having moved, and update boundaries move( 1:d+1, 2:d+1 ) = fish( 1:d+1, 2:d+1 ) & ... ( direction( 1:d+1, 2:d+1 ) == 4) & ( ~fish( 2:d+2, 2:d+1 ) ); fish(2:d+1,2:d+1)= ( fish(2:d+1,2:d+1) & (~move(2:d+1,2:d+1) ) ) | ... move(1:d,2:d+1); direction(2:d+1,2:d+1) = direction(2:d+1,2:d+1) .* ( 1-move(3:d+2,2:d+1)); updateboundaries; if dbug == 1, subplot(224), plotfish; disp(['i= ',num2str(i),' just moved south']), keyboard, end