minor code refactoring, wip
fixes issue #1019:

- fix ignored turn restriction on chains of degree-2 nodes
- add a cucumber test to test for potential regressions
use consistent typedef'ed types
replace boost::unordered_map, move hash function for pairs into its own header