When the economists start to develop a sense of humor, well, then you know it is pretty much all over. Economists have a peculiar sense of humor, but, a look at any writings by economists usually is of the dry tedious sort that would make good bedtime reading to children who need to be punished. Looking forward and looking back are two things economists do to ascertain a sense of reality. At the moment, neither is a fruitful enterprise as backward is steeped in nostalgia and old-fashioned ways for when banks were, well -- banks, and, markets were markets. Looking forward is what one an economist does after looking backward and umm...forward. But, my, how mind-shifting it is to look backward and forward from the perspective of the current immediate present which one can see as a sort of pair of rose-tinted glasses that have just shattered. And maybe you just want to cross the street and forward and backward are not helping with that. Worst of all, looking left and right just places the untidy politics algorithm in the middle of it all.
LeftwardRightward (guessstate, sequenceindex):
if sequenceindex is past the end of the sequence, return 1
if (guessstate, sequenceindex) has been seen before, return saved result
result - 0
for each neighboring state n:
result = result + (transition probability from guessstate to n given observation element at sequenceindex)*LeftwardRightward (n, sequenceIndex + 1)
save result for (guessState, sequenceIndex)