2 votes

Pset3- game of fifteen. My code runs perfectly. but check50 says....expected file to be of length 18, not 0

Sounds like you lost the logging section of the supplied code. It was in the distro fifteen.c at line 80 after the call to draw(): // log the current state of the board (for testing) for (int i = ...
1 vote
Accepted

Pset3 move problem

Use like if (y > 0 && j[y-1][x] == 0) and if (y < d-1 && j[y+1][x] == 0) (equivalent checks for x on the other lines) to prevent this from being evaluated for invalid coordinates....
  • 20.8k
1 vote

pset3 fifteen check50 error

It is not complaining about the compile, that gives a :). It is complaining that the board is not initialized correctly. Remember from the check50 section of the spec: Note that check50 assumes ...
1 vote
Accepted

"Expected Expression" Error on Move Function

These are all syntax errors. In the case of the first two, it's an incorrect initialization, more or less. I'll explain. in order to use the {...} technique, you have to do this at the same time as ...
  • 66.7k
1 vote

CS50 > Pset3 > Game of fifteen > init function :

If they are not swapped, the puzzle is not solvable. You can review the Wikipedia article about the game to learn about the arcane mathematics "happening behind the screen".
1 vote

working with game of fifteen

The error states that if non of your for loops are executed then function is not able to return any value to the function call. Reaching the end of a non void function without returning a value is ...

Only top scored, non community-wiki answers of a minimum length are eligible