implemented getNextNode()

getNextNode() returns the next node in the chain as selected based on
self.runningState, which keeps a window of the last (order) states
accessed.
added self.startState and self.endState

self.startState and self.endState are initialized to tuples of length
(order), representing the start and end states of a sequence
fixed getNextNode() crashing at end of sequence
stop getSequence() breaking if can't find an END
added addNextNode() function