slide puzzle implementation