kpp9c wrote: > Very simple finite automaton (?) > > I am not sure if this is and example of Finite Automaton or a Finite > State Machine or perhaps it is related to a transition table or markov > process. I am not a math person so i am not sure what it is called. I > googled around and got lots of super complicated gobbledegoo all with > knotty regex stuff, but what i want to do is much more simple. > > I am trying to use a table (called a transition table? i dunno) to > define a bunch of moves like so: > > 1 --> 2 5 > 2 --> 1 4 > 3 --> 3 > 4 --> 1 > 5 --> 4 3 > > so that i can generate a sequence that, given an initial value, will > continue to grow according to these rules. > > So starting with 1, we get: > > 1 > 2 5 > 1 4 4 3 > 2 5 1 1 3 > 1 4 4 3 2 5 2 5 3 > > > ..... etc. > > Essentially, iterating over the last added items to the list, applying > the table, adding those new items to the list, applying the table > again... etc, until the sequence reaches some predetermined number of > iterations and quits. > > > [ [1], [2, 5], [1, 4] , [4, 3], [2, 5], [1], [1], [3], [1, 4], [4, 3], > [2, 5], [2, 5], [3] ] >
[snip] I'm interested to know what you're then doing with the list. Depending on that you might want to view it (or implement it) in terms of a matrix, graph ... Duncan -- http://mail.python.org/mailman/listinfo/python-list