Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

To find neighbours

Name: Anonymous 2011-04-12 10:28

Lets suppose that we have an array which looks like this:


#(#(O O O O)
  #(O O X O)
  #(O O O O))


How would I go about to find the neighbours of 'X
without using loads of if-else ?

Name: Anonymous 2011-04-12 10:43

>>3
I had already figured that out, is there any better way to write a function that does this than doing loads of check-ups manually?

Something like:


(defun check-neigh (field x y)
  (let ((output '() ))
    (push (nth (1- y) (nth x field)))
    ...
    output))


just feels so unnecessary and long.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List