Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn traverse [v, dimensions, x, y, current, counter]
- (cond
- ;;check to see if v is empty
- (empty? v)
- v
- ;;checking that x and y are less than or equal to the dimensions
- (and (<= x dimensions) (<= y dimensions))
- ;;assigning the value of x and y in v to current
- (assoc-in v [x y] current)
- ;; if current is equal to 1 call flood fill and pass in the the relevant stuff from the vector and inc the counter
- (if = 1 current ( flood-fill [v,dimensions,x,y,current] inc counter))
- ;;if x is less than the dimensions inc x
- (if (< x dimensions) (inc x))
- ;;if y is less than the dimensions and x is equal to dimensions inc y
- (if (and (< y dimensions) (= x dimensions))(inc y))
- ;;sasdasdasdasdsa
- (if (and (= x dimensions) (= y dimensions) )
- ;;recur the function until the function is done
- (recur)
- )
- :else
- ;;once its done return the counter
- counter
- ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement