Enumerate "correct paths" for any block assembly
Implement a new method BlockAssembly.correctPaths
that enumerates all "correct paths" for a particular assembly, based on the implementation in correctstategraph.py
.
A sequence of assemblies is correct with respect to a reference assembly if every assembly in the sequence is a sub-assembly of the reference.
This method should return a finite-state machine (or some equivalent structure).
The best way to approach this is probably to start at the final state and work backwards, removing one block at a time. The routine stops when only the empty state is left. Below is some pseudo-code for traversing a correct-path FSA.
def traverseCorrectPaths(self):
stack = list()
stack.push(self)
while stack:
assembly = stack.pop()
for block in assembly:
sub_assembly = assembly.remove(block, in_place=False)
stack.push(sub_assembly)
return None
Edited by Jonathan Jones