Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; Popuniti područje kružnice kvadratima
- ;; Autor: Kristijan Burnik
- to crtaj :s :r :n :t :a :b
- (local "d "c "dija "p "t1 "t2 "h )
- if :n = 0 [stop]
- pu
- setpos :t
- make "h heading
- seth :h+45
- make "dija 0
- while [ (distance :s) < (:r-1) ] [
- make "dija :dija + 1 fd 1
- ]
- pd
- pu setpos :t pd
- make "d :dija/(sqrt 2)
- seth :h
- pd
- fd :d rt 90 make "t1 pos
- fd :d rt 90 make "c pos
- fd :d rt 90 make "t2 pos
- fd :d rt 90
- crtaj :s :r (:n-1) :t1 :a :c
- crtaj :s :r (:n-1) :t2 :c :b
- pu setpos :s pd
- end
- to popuni :r :n
- (local "a "b)
- circle :r
- pu fd :r make "a pos bk :r rt 90 fd :r make "b pos bk :r pd lt 90
- repeat 4 [
- crtaj pos :r :n pos :a :b
- rt 90
- ]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement