Javascript that solves the game of 15 puzzle