find a STL container or use a LUT to make sure that each of the pieces can only move in certain directions