Implementing the game of fifteen (a problem set from the CS50 class)