Robo Home | Changes | Preferences | AllPages

Okay this is my idea for a recursive PatternMatcher


Not really a new idea. MultipleChoice-SingleTickPatternMatching is basicaly what you describe. The only difference is you suggest is branching every x turns instead of every singe turn. I implemented MC-ST-PM last year and found that despite my reasonably optimized design it's far too slow and started skipping every turn before the first round even finished. Branching Every x ticks may improve the situation but I still believe it would be too slow to run unless x is so high that it's barely different than plain MC-PM. -- Rednaxela

I'm sure that it still skip a turn if your bullet need to go for 82 ticks :) --Nat

Actually I am referring to using a recursive method instead of a iterative method. It is still running all the same, except that recursion is usually faster than iteration. Pakistan wrote it badly, but he was saying you find the first match of your pattern, save the location in a new array, and then rerun the method with the new values searching for the next pattern in the series. however symbolic pattern matching and normal pattern matching are more efficient, because they match the whole sequence, instead of each individual digit of your log.


I think you have it the other way around, if the algorithm is logically the same, the iterative version is faster than the recursive one. Because if after unrolling the recursion, the underlying algorithm is the same you cannot gain speed by adding the overhead required to handle the calls. --Zyx

It isn't performing the same logic, it is just giving you the same result, it is an alternative method to iteration and not always faster. however it is not just based on implementation, it is also based on how the algorithm works. you technically can't have the same algorithm be both recursive or iterative. this is a misconception


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited March 24, 2009 20:58 EST by (diff)