1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Find all possible paths in a Matrix

Discussion in 'Mathematics' started by TheLukeMcCarthy, Oct 8, 2018.

  1. I'm looking for algorithms to find all paths in a 4 x 4 matrix.
    The rules are as follows

    • You can move in any direction (up, down, left, right, and diagonally)
    • The next square in the path must be a neighbour to the current square
    • Each square can only be used once
    • Each square in the path must be in the bounds of the matrix
    • No squares are restricted
    • Start squares don't matter
    • End squares don't matter

    Here is an example of a valid path

    _ _ _ _
    | |6| |8|
    |-|-|-|-|
    |5| |7|9|
    |-|-|-|-|
    |3|4|0| |
    |-|-|-|-|
    |2|1| | |
    |-|-|-|-|

    Login To add answer/comment
     

Share This Page