Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. (defn traverse [v, dimensions, x, y, current, counter]
  2. (cond
  3. ;;check to see if v is empty
  4. (empty? v)
  5. v
  6. ;;checking that x and y are less than or equal to the dimensions
  7. (and (<= x dimensions) (<= y dimensions))
  8. ;;assigning the value of x and y in v to current
  9. (assoc-in v [x y] current)
  10. ;; if current is equal to 1 call flood fill and pass in the the relevant stuff from the vector and inc the counter
  11. (if = 1 current ( flood-fill [v,dimensions,x,y,current] inc counter))
  12. ;;if x is less than the dimensions inc x
  13. (if (< x dimensions) (inc x))
  14. ;;if y is less than the dimensions and x is equal to dimensions inc y
  15. (if (and (< y dimensions) (= x dimensions))(inc y))
  16. ;;sasdasdasdasdsa
  17. (if (and (= x dimensions) (= y dimensions) )
  18. ;;recur the function until the function is done
  19. (recur)
  20. )
  21. :else
  22. ;;once its done return the counter
  23. counter
  24. ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement