ramone
Member level 3
- Joined
- Oct 5, 2003
- Messages
- 58
- Helped
- 1
- Reputation
- 2
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Patras University
- Activity points
- 721
hi,
Suppose you had a matrix called subsets that has all possible and connected permutations of some cells in a grid. That means that if you had 9 moves then the matrix called subsets has 9 entries with numbers that show which cells are visited and with which order. This matrix is very long! In order to reduce that length i must throw all the entries that are useless to me. It comes out that i dont want any subsets that visit the same cell 2 times (for example it has number 17 twice and so on). Can anyone support me with a QUICK algorithm for doing that? I would like this to be in matlab but also a good pseudocode explanation could be useful.
Thanks in advance
EXPLANATION:
the grid is something like that:
57 58 59 60 61 62 63 64
49 50 51 52 53 54 55 56
41 42 43 44 45 46 47 48
33 34 35 36 37 38 39 40
25 26 27 28 29 30 31 32
17 18 19 20 21 22 23 24
9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8
I always start at 1. If you have 7 moves then some subsets would be:
57 49 41 33 25 17 9 1
34 35 34 33 25 17 9 1
50 49 41 33 25 17 9 1
as you can see in the second subset 34 appears twice. I DON'T WANT THAT!
Hope i have been clear!
Suppose you had a matrix called subsets that has all possible and connected permutations of some cells in a grid. That means that if you had 9 moves then the matrix called subsets has 9 entries with numbers that show which cells are visited and with which order. This matrix is very long! In order to reduce that length i must throw all the entries that are useless to me. It comes out that i dont want any subsets that visit the same cell 2 times (for example it has number 17 twice and so on). Can anyone support me with a QUICK algorithm for doing that? I would like this to be in matlab but also a good pseudocode explanation could be useful.
Thanks in advance
EXPLANATION:
the grid is something like that:
57 58 59 60 61 62 63 64
49 50 51 52 53 54 55 56
41 42 43 44 45 46 47 48
33 34 35 36 37 38 39 40
25 26 27 28 29 30 31 32
17 18 19 20 21 22 23 24
9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8
I always start at 1. If you have 7 moves then some subsets would be:
57 49 41 33 25 17 9 1
34 35 34 33 25 17 9 1
50 49 41 33 25 17 9 1
as you can see in the second subset 34 appears twice. I DON'T WANT THAT!
Hope i have been clear!