[Question]
  [
Multi-dimensional chess is an extension of normal chess that is played on an 8x8x8x8... "board".
In normal 2D chess, a knight's move is a movement by a vector of \$ \begin{bmatrix} \pm 2 \\ \pm 1 \end{bmatrix} \$ or \$ \begin{bmatrix} \pm 1 \\ \pm 2 \end{bmatrix} \$, as long as it doesn't cause the knight to go outside the \$ 8 \$ by \$ 8 \$ bounds.
In \$ N \$-dimensional chess, a knight's move is a vector of
$$ \begin{bmatrix} \vdots \\ \pm 2 \\ \vdots \\ \pm 1 \\ \vdots \end{bmatrix} 
\text{or}
\begin{bmatrix} \vdots \\ \pm 1 \\ \vdots \\ \pm 2 \\ \vdots \end{bmatrix} $$
where \$ \begin{bmatrix} \vdots \end{bmatrix} \$ is any number of \$ 0 \$s (such that the vectors are \$ N \$ in rank), again as long as it doesn't go outside the \$ 8^N \$ bounds.
## Task
Given a coordinate vector of length \$ N \$, output all possible coordinate vectors that are a knight's move away on an unobstructed \$ 8^N \$ chess board.
You should assume the input vector will always be at least 2-dimensional (i.e., \$ N \ge 2 \$), and always within the bounds of the board.
## Test-cases
Using 1-indexed coordinates (0-indexed available [here](https://tio.run/##dVRLdsMwCNznFD6A@14RkuAuftl33XbVy6dWAI9Q02w8IGbET/n5@ng8vj83etPt/U0ej4P2Te8bfkfZt37ft4P3Te63o@5bS@dt@OPcvjy@zb/d@QXf6v566p2fM7JckoecOsNhEhNkhwKop6bDmmBFQAWt@dUNUJ@QnZYhIYCikil5QEGpnCAhgM5ah9A4v2qdCBVw1OyQAfuT3Dw2Q0IAuQJ5erzCgoDobHExg4R@17n1t9ELnddjyPThuKpUF1cfdn9C8UaKe21sY5vIch6XXtvGqMPKD8sg44yQbwkhxllUaGHBM4kCq4BHcXvwCP2nuH10wnZQr8X1NVFn9tUiWJqs9lwkTbOYeIyt1mTZUCSdKTZyslpYnCzCpnUsRU0W4QZ7PZIi4waJrCsiFbtMLyxKkYRnLVCxajlZZFtYbdlG7LWFsiYkqSNtdfBKqZHO9MJ1dfSVIuufgqQirkz76iiJov4EZwdjtFNitmnZ0VOmGvPIjr5SsoNTLRod60ljKk6j67JSFM@c/3WUlVKSaPRDp1H@cfBKYfzn95S6jTI7Wkr9GnZPGq8cZaWUJDplWtNb0Gk/@uooydGThvhL@AU "Zsh – Try It Online"))
```
Input            Output
[1, 8]           [2, 6], [3, 7]
[4, 5]           [5, 7], [3, 7], [3, 3], [5, 3], [6, 6], [2, 6], [2, 4], [6, 4]
[6, 5, 2]        [7, 7, 2], [5, 7, 2], [5, 3, 2], [7, 3, 2], [8, 6, 2], [4, 6, 2], [4, 4, 2], [8, 4, 2], [7, 5, 4], [5, 5, 4], [8, 5, 3], [4, 5, 3], [4, 5, 1], [8, 5, 1], [6, 6, 4], [6, 4, 4], [6, 7, 3], [6, 3, 3], [6, 3, 1], [6, 7, 1]
[5, 1, 3]        [6, 3, 3], [4, 3, 3], [7, 2, 3], [3, 2, 3], [6, 1, 5], [4, 1, 5], [4, 1, 1], [6, 1, 1], [7, 1, 4], [3, 1, 4], [3, 1, 2], [7, 1, 2], [5, 2, 5], [5, 2, 1], [5, 3, 4], [5, 3, 2]
[8, 8, 8]        [7, 6, 8], [6, 7, 8], [7, 8, 6], [6, 8, 7], [8, 7, 6], [8, 6, 7]
[1, 1, 1, 1]     [2, 3, 1, 1], [3, 2, 1, 1], [2, 1, 3, 1], [3, 1, 2, 1], [2, 1, 1, 3], [3, 1, 1, 2], [1, 2, 3, 1], [1, 3, 2, 1], [1, 2, 1, 3], [1, 3, 1, 2], [1, 1, 2, 3], [1, 1, 3, 2]
[7, 3, 8, 2]     [8, 5, 8, 2], [6, 5, 8, 2], [6, 1, 8, 2], [8, 1, 8, 2], [5, 4, 8, 2], [5, 2, 8, 2], [6, 3, 6, 2], [8, 3, 6, 2], [5, 3, 7, 2], [8, 3, 8, 4], [6, 3, 8, 4], [5, 3, 8, 3], [5, 3, 8, 1], [7, 2, 6, 2], [7, 4, 6, 2], [7, 1, 7, 2], [7, 5, 7, 2], [7, 4, 8, 4], [7, 2, 8, 4], [7, 5, 8, 3], [7, 1, 8, 3], [7, 1, 8, 1], [7, 5, 8, 1], [7, 3, 7, 4], [7, 3, 6, 3], [7, 3, 6, 1]
[8, 4, 7, 8, 4]  [7, 6, 7, 8, 4], [7, 2, 7, 8, 4], [6, 5, 7, 8, 4], [6, 3, 7, 8, 4], [7, 4, 5, 8, 4], [6, 4, 8, 8, 4], [6, 4, 6, 8, 4], [7, 4, 7, 6, 4], [6, 4, 7, 7, 4], [7, 4, 7, 8, 6], [7, 4, 7, 8, 2], [6, 4, 7, 8, 5], [6, 4, 7, 8, 3], [8, 3, 5, 8, 4], [8, 5, 5, 8, 4], [8, 6, 8, 8, 4], [8, 2, 8, 8, 4], [8, 2, 6, 8, 4], [8, 6, 6, 8, 4], [8, 3, 7, 6, 4], [8, 5, 7, 6, 4], [8, 2, 7, 7, 4], [8, 6, 7, 7, 4], [8, 5, 7, 8, 6], [8, 3, 7, 8, 6], [8, 3, 7, 8, 2], [8, 5, 7, 8, 2], [8, 6, 7, 8, 5], [8, 2, 7, 8, 5], [8, 2, 7, 8, 3], [8, 6, 7, 8, 3], [8, 4, 6, 6, 4], [8, 4, 8, 6, 4], [8, 4, 5, 7, 4], [8, 4, 8, 8, 6], [8, 4, 6, 8, 6], [8, 4, 6, 8, 2], [8, 4, 8, 8, 2], [8, 4, 5, 8, 5], [8, 4, 5, 8, 3], [8, 4, 7, 7, 6], [8, 4, 7, 7, 2], [8, 4, 7, 6, 5], [8, 4, 7, 6, 3]
[3, 4, 2, 5, 7, 3, 2, 2, 4, 3, 6, 4, 5, 7, 5, 8, 8, 8, 7, 8, 3, 7, 5, 8, 7]  https://gist.github.com/pxeger/8a44daec42d34d9507d7ca6431e2a9fc
```
## Rules
* Your code does not need to practically handle very high \$ N \$, but it must work in theory for all \$ N \$
* You may use 0-indexed (\$ [0, 7] \$) or 1-indexed (\$ [1, 8] \$) input and output, but this must be consistent
* You may optionally take a second input, an integer \$ N \$, which is the length of the vector and the number of dimensions
* You may use any [standard I/O method](https://codegolf.meta.stackexchange.com/q/2447)
* [Standard loopholes](https://codegolf.meta.stackexchange.com/q/1061) are forbidden
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins
  
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~93~~ 81 bytes
```
->a,n{w=*1..8;w.product(*[w]*~-n).select{|r|r.zip(a).sum{|x,y|(x-y).abs*8/3}==7}}
```
[Try it online!](https://tio.run/##LYjRCsIgFEDf@4oenVyNtdaEsB8RH9zaIKglbuJM7ddNopfDOcfY3ueJZ3JVMAfHcU0puziqzetmhxVh4ST@kLmiy/gYhzVEEw193zVSZdlniBv4iDbiK6r6BbNDkzjvUsp6PwlRA5NwlLtfnKEtDs0/GZygg0IJrcxf "Ruby – Try It Online")
### Quickly explained - old version
Generate all possible positions as vectors of N numbers between 1 and 8, then check the differences between each vector and the starting position, the sorted array of absolute values of the components must be `[<bunch of 0s ...>, 1, 2]`
### And then:
(Thanks [@dingledooper](https://codegolf.stackexchange.com/users/88546/dingledooper)): If we multiply the differences by 8 and divide them by 3, the vector becomes `[<bunch of 0s>, 2, 5]` and its sum is unequivocally 7, no other combination of numbers can produce the same sum, so we can simplify the check a lot and shave off 12 bytes.
[Answer]
# [JavaScript (V8)](https://v8.dev/), 114 bytes
0-indexed. Prints all valid vectors.
```
v=>v.map((x,i)=>v.map((y,j)=>j>i&&(g=n=>n--&&g(n,(V=[...v],x-(V[i]=n&7))**2+(y-(V[j]=n>>3))**2-5||print(V)))(64)))
```
[Try it online!](https://tio.run/##XY/BioMwFEX3fsVbDOGlkwS0tgol2c0vuJFARUYn0oliS2hp@@3OU8HFQEjuOe8mkK4K1bUe3XCTIZ8aPQVtgvqtBsS7cHyDh@gIOuMYw1Z7bbyUjLXoBRa6VEoFK@4Si9JZ7VnG@W6XfOJjNh0ZY/aLkofXaxidv2HBOcdjSvt0KiOAMhaQWzGnVMBhTUdKApIVKFFnv0JO7e1CvEzmtXJGtWWebGV6M1tUaiMbqaYfv6r6BwNoA0@gA9aP@ll4kBDzE9S9v/aXb3XpWzyXH8/wtmfSDYZ/Q8I3n/4A "JavaScript (V8) – Try It Online")
### How?
Let \$v\$ be the input vector of length \$N\$.
For each pair \$(i,j),\:0\le i<j<N\$ and each value \$n\in[0\dots 63]\$, we compute:
$$X=n \bmod 8\\
Y=\lfloor n/8 \rfloor\\
V=[v\_0,\:\dots,v\_{i-1},\:X,\:v\_{i+1},\:\dots,v\_{j-1},\:Y,\:v\_{j+1},\:\dots,\:v\_{N-1}]$$
We print the output vector \$V\$ if:
$$(v\_i-X)^2+(v\_j-Y)^2=5$$
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 13 bytes
```
8RṗLạṢ¹ƇØ½ƑʋƇ
```
[Try it online!](https://tio.run/##ASsA1P9qZWxsef//OFLhuZdM4bqh4bmiwrnGh8OYwr3GkcqLxof///9bNiw1LDJd "Jelly – Try It Online")
## Explanation
```
8RṗLạṢ¹ƇØ½ƑʋƇ   Main monadic link
8R              Range from 1 to 8
  ṗ             To the Cartesian power of
   L              the length of the input
            Ƈ   Filter by
           ʋ    (
    ạ             Absolute difference with the input
     Ṣ            Sort
       Ƈ          Filter by
      ¹             identity
        Ø½Ƒ       Equals [1,2]?
           ʋ    )
```
It's a shame that `ṗ` doesn't automatically convert the left argument to a range, like other list functions…
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 12 bytes
Takes `N` as first input and the current position as second input.
```
8LIãʒα0K{2LQ
```
[Try it online!](https://tio.run/##yy9OTMpM/f/fwsfz8OJTk85tNPCuNvIJ/P/fmCvaQkcBhGIB "05AB1E – Try It Online")
```
8L            # push the range [1 .. 8]
  Iã          # all N-tuples of integers in [1 .. 8]
    ʒ         # only keep those for which ...
     α        # ... the element-wise absolute difference to the current position
      0K      # ... without zeros
        {     # ... sorted ascending
         2L   # ... and [1, 2]
           Q  # ... are equal
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 47 bytes
```
Array[#~Norm~1#.#&@*List,0#+8,1-#]~Position~15&
```
[Try it online!](https://tio.run/##JYo9C4MwGIR3/8YLDu1ZGk1qlha7lyJ0FIcglWZIhJiliPnrqanccM99GOU/b6O8HlQcr/HunPp2FJ6TM4HRifLm8NCzx5mOEqygPrTTrL2ebGAij63T1ndU3MaG@jy8BmXDki0MckW2cIhkFwiUCQQYqgQScn8w/JWwRrW15T5z1Fvga7bGHw "Wolfram Language (Mathematica) – Try It Online")
Returns a list of coordinates. The product of the taxicab distance and the squared Euclidean distance can only be 15 on knight's moves.
```
Array[           &@*List,0#+8    ]                  for the whole chessboard
                             ,1-#                   offset so the input location is 0:
      #~Norm~1                                          taxicab distance times
              #.#                                       squared Euclidean distance
                                  ~Position~15&     find 15s
```
---
### [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~64~~ 55 bytes
```
x/.Solve[0<x<9&&!#-2<x<#+2,x∈#~Sphere~√5,Integers]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7v0JfLzg/pyw12sCmwsZSTU1RWdcIyFLWNtKpeNTRoVwXXJCRWpRa96hjlqmOZ15JanpqUXGs2v@Aosy8kmhlXbs0B@VYtbrg5MS8umquakMdi1odrmoTHVMQZaZjqmMEYpjqGOoYgxgWOhYQFYY6YAhimusYA0WNINImOuZAjkktV@1/AA "Wolfram Language (Mathematica) – Try It Online")
Returns a list of coordinates. `x/.` could be omitted (-3 bytes) for a slightly uglier output format (a list of `{x->*coord*}`s).
```
x/.Solve[                 ,             ,Integers]& integer coordinates which are
                           x∈#~Sphere~√5            √5 away from the input,
         0<x<9                                      inside the chess board,
              &&!#-2<x<#+2                          and 2 away on some dimension.
```
[Answer]
# [Python](https://www.python.org), 115 bytes
```
lambda p,N:[i for i in[[*map(int,f"{j:0{N}o}")]for j in range(8**N)]if~-sum((k-l)**(2*N)for k,l in zip(i,p))==4**N]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=dVbNjtMwEL6ivgBXK6ekSpF_YntVqa_Q095CD0WbQHbTJGqzSLBaXoTLSgjeCZ4Gu7YzHrP04pnP843nz42__5q-zJ_G4eVHu3v_83FuNze_L_3x9OHuSKZyv6070o5n0pFuqOv16Tjl3TCXbfZ0v6VP--fxOSsO1uDeGJDzcfjY5Dfr9b44dO23zeXxlOcPm75Yr3NuQGv4UPbW9GtnPJVTUex2lbE_uKP_vHl7u8uyrKYl0QcCv5qVRB5KUvOSqMOqFiWp0H5l8bDvVm7Xyq_S8xmswuPC-DOLsWSLy1oZPxZwLiKRe1GBqI1PLwokCjAQQKv80RWI-ipyT8MiBQMaMomCB1FBqhyJFAyoydU6svtLrhFBgGhz9iIHUV7JlbfFIgUD6j1QHx5PRQYGobLMO3MihXqLuPQrWwsdj4d1Iy2wZKm9c-2bLa-i8oVUHnVts9NEXcz20GXaOOTh0g-aEznsUYiXBUcc9kKGzizwnAsGGgMeDacHHoX603C6rYSbQb0Mrh8T7Zky1ShoGmnVdZA06kXE4zDVGmmuKQrtaZjISKuCxpEW5oSBT3WNRaIRUej2KGQZTlAhagGWGmaZvqJRZBk0l5EATQLPadRNoXDDZm2XKVRpQApVpEoBnlJECCe64ToFZEpR6Z-CQkkskcoUYIii_RWMAQ6tjQJzk4YBiSLVoR8YkCkFAxzlokPFJPIRJadD1VVK0XDN-X8BllIYchrqoaNW_gPwlBIAEfITAOgUqFDoS7Ml8vEawFIKQ06jSAW6CzqaD5kCDAES-VD-Jpjv87vL1Hdz3w3NJS9WK_tdn-1X_Xa7Mn9DXTmSHbFvhebzsS_brp-bc943Qzk7Yp4RkhVFYY2ns3lQmKfAZTzPzV0-mgeBF1uDGlLeGcvCvQ9eXtz6Fw)
#### Old [Python](https://www.python.org), 116 bytes
```
lambda p,N:[i for i in[[*map(int,f"{j:0{N}o}")]for j in range(8**N)]if 4**N+1==sum((k-l)**(2*N)for k,l in zip(i,p))]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=dVbNjtMwEL6ivgBXK6ekZJF_YntVqa_Q095CD0WbQHbTJGqzSLDaJ-FSCcE7wdNg13bGY5Ze_M3n-cYz9rjx91_T1_nzOFx-tNsPP5_m9ub299wfjh_vD2Qqd5u6I-14Ih3phrpeHw9T3g1z2WbPDxv6vHsZX7Jibx0ejAM5HYZPTX67Xu-KfdeSyoB3bLs9Px3z_PGmL9brnJs56_9Y9lbxrTMBy6ko9m7tP2_e3m2zLKtpSfSewK9mJZH7ktS8JGq_qkVJKjRfWT7Mu5HbsfKj9HoGo_C8MPHMYDzZErJWJo4lXIgIcg8VQG1ieigQFOAgQFb5pSuA-gq5l2FIwYGGSqLkASoolSNIwYGaWm0gO7_UGgkEQFuzhxygvIor74shBQfqI1CfHk8hA4ews8wHc5DCfot461d2L3TcHjaMtMRSpfbBtT9seYXKb6TyrDs2203U5WwXXbqNQx2u_GA5yGGOQr4sBOIwFyp0bkHnQjCwGOhoWD3oKOw_DavbnXA9qJfG9W2ivVKmFgVLI6u6NpJGZxHpOHS1RpY7FIXmNHRkZFXB4sgKfcIgprrmIlGLKHR7FPIMK6iQtQBPDb1MX7Eo8gyWq0iAJUHnLOq6ULhms75LF6o0IYV2pEoJnkpESCe64TolZCpR6Z-CQkUsmcqUYEii_RWMCQ5HGyXmOg0TEmWqw3lgQqYSTHBUiw47JlGMqDgddl2lEg3XnP-XYKmEoaBhP3R0lP8QPJUEQoT6BBA6JSqU-nLYEsV4jWCphKGgUaYC3QUd9YdMCYYIiWIofxPM9_n9eeq7ue-G5pwXq5X9os_2e363WZm_oa4cyZbYx0Lz5dCXbdfPzSnvm6GcnTDPCMmKorDO08m8KMwj4Dye5uY-HwvzYHCwNawR5Z3xLNz74HJx418)
Takes the 0-based list and its length as inputs. Uses octal representation as a poor-man's `itertools.product` to generate all squares and then filters out the bad ones using a high-p Minkowski distance.
[Answer]
# Haskell, ~~132~~ ~~119~~ 118 Bytes
```
e!(o:x)=[z|o==0,z<-[e:x,-e:x]]++map(o:)(e!x)
_!_=[]
k p=filter(all(`elem`[0..7]))$zipWith(+)p<$>([0<$p]>>=(1!)>>=(2!))
```
[Try it Online!](https://tio.run/##HYrLCoMwEADvfkUCOezig7Q9COL6Gz2EoDlsMRg1WA8i/ffUloGZy4zuPXEIKbGEtTmQzPlZiXRxtqXh5ijKS9bm@eziNSCwPDDrZU/GZpOI9PJh5w1cCDBw4Hkwuqpqi6hOH59@HyHH2KoOjG5VtF1HcJP4y10iptn5RZCIm192ocRk6kL/edj0BQ)
-13 bytes thanks to Wheat Wizard
-1 byte thanks to pxeger
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), ~~134~~  119 bytes
```
lambda v,d:[i for i in product(*[range(8)]*d)if[1,2]==sorted(abs(x-y)for x,y in zip(i,v)if x-y)]
from itertools import*
```
[Try it online!](https://tio.run/##dctBDoIwEIXhPafosiVjAlSUaDhJ7aJYqpMAbUol4OWxxMSVZHbzvd8t4WkHXjm/mvq2dqpvtCIT6ItAYqwnSHAgzlv9ugeaCq@GR0srJlPN0IgcClnXo/Wh1VQ1I50PC9uyGZYtfKOjCFOckk1kYrztCYbWB2u7kWDvYpuuzuMQqKEig0xCwdj1@2HJTzgcd6SEI@QS@D87Q7xd43CKziWUjK0f "Python 3.8 (pre-release) – Try It Online")
* Generate all possible coordinates.
* Then, compute he list of the absolute difference between our vector and the coordinate.
* Remove all `0` in this list an verify that the remaining contains exactly `1` and `2`
Thanks to @ovs for -15 bytes
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 66 bytes
```
a->forvec(b=[[1,8]|i<-a],norml2(a-b)==5&&normlp(a-b)==2&&print(b))
```
[Try it online!](https://tio.run/##LYxNCoMwEIWvMrgICSQLU63SNu57BsliLLUIVodgC4XePZ2kwsD7mY9HGCbzoDiCi2i6cQ3v@00Oru9L3frvdDHo9bKG52wlmkE5VwuRM@3ZCkFhWjY5KBWRaP5IBNPBvyyuC722ExQaUJ1hlKg0pHFoPZtKQ530yKrBJsvK30OyLVM7WOY2XUoNA/lnd4x3mlxU3qv4Aw "Pari/GP – Try It Online")
For input \$a\$, find all coordinate vectors \$b\$ on the chessboard such that the \$l\_2\$ distance ([Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance)) between \$a\$ and \$b\$ is \$\sqrt{5}\$, and the \$l\_\infty\$ distance ([Chebyshev distance](https://en.wikipedia.org/wiki/Chebyshev_distance)) between \$a\$ and \$b\$ is \$2\$.
[Answer]
# [JavaScript (V8)](https://v8.dev/), 96 bytes
```
a=>{for(i=a>>2;++i<a*4;)/[09]/.test(i)|[...a].map((n,j)=>s+=((i+'')[j]-n)**2,s=0)^s^5||print(i)}
```
[Try it online!](https://tio.run/##bc5LDoIwEIDhvadg15ZHEWyliuUiiEljxJRgIZSwEc@OrUZNTGf1L77JTCMmoc@D7MdoYkvNF8GLe90NUHJRFGkeBPIgfJKjuFzvqhiPFz1CieYSYywqfBM9hCpsEC90wCGUAQCobKpIId9PQ83X6KRPdJ77QSq7@FjOndJde8Ftd4XgqBK2Byj3PK@GIGEmV3@A0B8g1AG2NH0LA0w7BE02X2HaIRhjX2HaIRIzL2L/NOMg2YalH2LbdYdkjFhj79g2uTwB "JavaScript (V8) – Try It Online")
Input is a string, for example, `[6, 5, 2]` is inputed as `"652"`. Output each answer per line to stdout.
---
# [Python 2](https://docs.python.org/2/), 104 bytes
```
lambda a:[i for i in range(a/4,a*4)if sum((q in'90')*6+(int(p)-int(q))**2for p,q in zip(`a`,`i*10`))==5]
```
[Try it online!](https://tio.run/##TcxLDsIgEIDhvaeYXRnEaClUNOlJ1ASMoiSKWHWhl6/gg3Y2kz/fQHjejxfPO9usu5M5b3cGzHLlwF5acOA8tMYf9sRMBTNUoLNwe5wJuUYqFrMCaT0mzt9JwElaV0RKeXocWLqBlwtEG820o@VMIzaN3HShTbelYlAsCwZxbCzE0ReEHIKQGWrJs9hUWWRZDSRWFqXUQGJlKeP8yX4q07xSvKdU/X9irsTP7LcQuzc "Python 2 – Try It Online")
Input `[6, 5, 2]` as an integer `652`. Output list of integers.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 46 bytes
```
ＦＬθＦＬθＦ⊗¬⁼ικＦ²⊞υＥθ⁺ν⁺×⁼ξι⊗∨λ±¹×⁼ξκ∨μ±¹ＩΦυ⁼ι﹪ι⁸
```
[Try it online!](https://tio.run/##bY67CsJAEEV7v2LKWRgLrQRLH5XGFHYhxZqsyeIka/Yh/v2aYIIoDgPz4NzLLWppCyM5xquxgAfVVr7GTgj4e29NuLAqMTEed12Q7FAT3ISYgKWANLgaA8FR3rEjSDk4bMd51o1yk/JJoAXB5HmyyASJqqRXuBgsCX75W//rueab62s9S61uPW6k87jX7JUdMnwyHk0Z2Azb6i2IMcsWBGPneZw/@AU "Charcoal – Try It Online") Link is to verbose version of code. 0-indexed. Outputs using Charcoal's default array output of each element on its own line with separate results double-spaced from each other. Explanation:
```
ＦＬθ
```
Loop over the possible `N` dimensions for the 2-step part of the knight's move.
```
ＦＬθ
```
Loop over the possible `N` dimensions for the 1-step part of the knight's move.
```
Ｆ⊗¬⁼ικ
```
Loop over 2-step moves toward or away from the origin, but only if different dimensions were chosen.
```
Ｆ²
```
Loop over 1-step moves toward or away from the origin.
```
⊞υＥθ⁺ν⁺×⁼ξι⊗∨λ±¹×⁼ξκ∨μ±¹
```
Calculate the coordinates of the move.
```
ＩΦυ⁼ι﹪ι⁸
```
Output only those coordinates which stay within the bounds of the board.
[Answer]
# [Python 3](https://docs.python.org/3/), 230 210 bytes
```
v=lambda n:sum([[m.insert(i,0)or m for m in v(n-1)]for i in range(n)],[])if n>2else[[i,j//i]for i in[-2,-1,1,2]for j in[2,-2]]
k=lambda*l:[p for p in[[*map(sum,zip(l,m))]for m in v(len(l))]if min(p)>0<9>max(p)]
```
Thanks to Jakque for the -20
[Try it online!](https://tio.run/##TY5BjsIwDEX3nCJLG7lAAzMaEPQiURYZERhDYqK2IODyJS0MYmP5Pdv6Trf27yTzrrtsgou/W6dk1ZwjGBMnLI2vW2Ca4alWUe2GyqIuIEWJtmfuuXay9yBoyVjknZJK@9B4Y5gO0ym/F02hqSipJD2oQ6@y0daOjq/4cViZNCSlfmrG0SXID9GdEwSK@Ix9vRG8QMgqZ0YWSFjN1ssqumtubZdqlhaOUJL6QRz944LU1wd@ZySlP0zGfDJH7B4 "Python 3 – Try It Online")
Python 3 solution that does not use any external modules and calculates the possible moves by recursivly generating all possible moves before filtering out impossible ones.
The original (non-golfed) code that I wrote:
```
def moves(n): # n is the number of dimensions
    out = []
    if n > 2: # If higher then base dimension
        for i in range(n): # For each possible location that the 0 can be
            temp = [move for move in moves(n-1)] # Generate the previous dimension's move list
            for j in range(len(temp)): # Insert 0 in the same location for all moves
                temp[j].insert(i, 0)
            out.extend(temp) # Add to master move list
    else: # Base case, if n = 2
        out = [[1, 2], [1, -2], [-1, 2], [-1, -2],
               [2, 1], [2, -1], [-2, 1], [-2, -1]]
    return out
def knights_moves(*loc):
    n = len(loc) # count dimensions
    # Debug
    print(f"n: {n} n-out: {len(moves(n))}")
    pos_list = []
    for move in moves(n): # Iterate through every move
        pos_list.append([a+b for a, b in zip(loc, move)]) # Add move elementwise with original location 
    filtered = [pos for pos in pos_list if min(pos) > 0 and max(pos) < 9] # Check if the move ins
    return filtered
```
Any suggestions/tips or questions are very welcome!
[Answer]
# [Haskell](https://www.haskell.org/), 66 bytes
```
f a=[x|x<-mapM(\_->[1..8])a,sum[n^2*9`div`4|n<-zipWith(-)a x]==11]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00h0Ta6oqbCRjc3scBXIyZe1y7aUE/PIlYzUae4NDc6L85IyzIhJbMswaQmz0a3KrMgPLMkQ0NXM1GhItbW1tAw9n9uYmaegq0CSH@8QkFRZl6JgopCmkK0uY6CsY6ChY6CUex/AA "Haskell – Try It Online")
Essentially a port of G B and dingledooper's Ruby answer.
]