Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function z10 (r)
- n=1;
- while ~r.is_mark
- b=kvadrat (r,n);
- if b==0
- break
- end
- n=n+2;
- end
- end
- function result=around_the_wall(r,u,v)
- count=0;
- while r.is_bord (v)
- r.step (u)
- count=count+1;
- end
- if ~ r.is_bord(v)
- r.step(v)
- result=true;
- else
- result=false;
- end
- while count>0
- r.step(invert (u))
- count=count-1;
- end
- end
- function s = invert (s)
- if s == 'w'
- s = 'o';
- elseif s == 'o'
- s = 'w';
- elseif s == 'n'
- s = 's';
- elseif s == 's'
- s = 'n';
- end
- end
- function y=kvadrat (r,n)
- y=1;
- for s = 'oswn'
- if s == 'o' || s == 'w'
- z = 'n';
- else
- z = 'o';
- end
- for k=1:n
- around_the_wall(r, z, s);
- if r.is_mark
- y=0;
- return
- end
- end
- end
- around_the_wall(r, 'n', 'w');
- around_the_wall(r, 'w', 'n');
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement