again, invariants and what the function accomplishes. Your comments confuse me - "all possible moves"? what is the space of movements? i know you're doing djikstra's; i'd suggest following the pattern more explicitly (i.e. talking about paths instead of nodes)