I'm having trouble finding sequences.

So basically I have a map that holds a key and a string with all the valid moves.

For example:

A - "IJ"
B - "KMI"
C - "FJLN"
D - "GMO"
....
...
..


What I need to do is find all the sequences of 10 that are possible. I was thinking of looping through each key since that would account for the first letters of each sequence but when I try to throw in some recursion, things get hairy.

So the psuedocode would something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
foreach (key in keys)
{
  count = 1
  find sequences(keys[i])
}

find sequences(char key)
{
  string moves = keys[key]

  foreach(char in moves)
  { 
     if (count < 10)
     {
        count++
        findsequences(moves[i])
      }
  }


But this wouldn't account for them all would it? Can someone point me in the right direction as far as the algorithm goes?
Last edited on
Anybody?
Topic archived. No new replies allowed.