add 8 puzzle algorithm