added generality for eightpuzzle.py