Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 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.  
  11. ;; TO DO if current is equal to 1 call flood fill and pass in the the relevant stuff from the vector and inc the counter
  12. (= current 1)
  13. (traverse (flood-fill v dimensions x y 1 0) dimensions (inc x) y current (inc counter) )
  14.  
  15. ;;if x is less than the dimensions inc x
  16. (if (< x dimensions)
  17. (inc x))
  18. ;;if y is less than the dimensions and x is equal to dimensions inc y
  19. (if (and (< y dimensions) (= x dimensions))
  20. (traverse v dimensions 0 (inc y) current counter))
  21. ;;sasdasdasdasdsa
  22. (if (and (= y dimensions) (= x dimensions))
  23. (counter))
  24. ;;TO DO recur the function until the function is done
  25.  
  26. :else
  27. ;;once its done return the counter
  28. (counter)
  29. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement