Ok
tilly, I think I understand now. Basically, one simple way to do
this optimization would be to keep a list of all states you've visited so
far that have failed. Not the exact state that failed, but the furthest
in the past state that would definitively lead to that failed state.
Then, before proceeding to any further state, you check to make sure
your current state isn't in the list of failed states. You could also
prune states that are too old to match anymore, and also optimize the
search of this failed state list heavily based on your current state.
The other thing you could do to make it more efficient is instead of
going to the furthest past state, you could allow branching and store
multiple fail-states for each failure that occurs.
State machines are odd beasts :) .
Ciao,
Gryn
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.