Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.61 KB | None | 0 0
  1. function checkCells (R)
  2.     move(R,'s',0)
  3.     move(R,'w',0)  
  4.     move(R,'o',1)
  5.     R.mark()
  6.     direction = 'w';
  7.     while ~R.is_bord('n')
  8.         R.step('n')
  9.         move(R, direction, 1)    
  10.         R.mark()
  11.         direction = changeDirection(direction);
  12.     end
  13. end
  14.    
  15. function move(R, direction, marker)
  16.     while ~R.is_bord(direction)
  17.         if marker & ~R.is_mark()
  18.             R.mark()
  19.         end
  20.         R.step(direction)
  21.     end
  22. end
  23.    
  24. function Direction = changeDirection (direction)
  25.     if direction == 'o'
  26.         Direction = 'w';
  27.     else
  28.         Direction = 'o';
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement