0

Can someone help me understand what's going on with my code? check50 keeps telling me "can't check until a frown turns upside down" even though the code compiles correctly. I don't know what this means. And while there's been some suggestions here on how to solve this, they all seem to be different for everyone. Can someone take a look at my code and point out where I need help?

:) fifteen.c exists
:) fifteen.c compiles
:( init initializes 3x3 board correctly
   \ expected file to be of length 18, not 36
:( init initializes 4x4 board correctly
   \ expected file to be of length 38, not 64
:| 3x3 board, move blank up twice   
   \ can't check until a frown turns upside down
:| 3x3 board, move blank left twice
   \ can't check until a frown turns upside down
:| 3x3 board, move blank left then right
   \ can't check until a frown turns upside down
:| 3x3 board, move blank up then down
   \ can't check until a frown turns upside down
:| 3x3 board, move up-up-left-down-down-left-up-up-right-down-down-right
  \ can't check until a frown turns upside down
:| 3x3 board, from start try to move tile 2, 4, 5, 6, 7, 8
   \ can't check until a frown turns upside down
:| 3x3 board, move blank left (tile 1) then up (tile 4), then try to move 
tiles 1, 2, 6, 8
   \ can't check until a frown turns upside down
:| 3x3 board, move blank up (tile 3), then try tile 2
   \ can't check until a frown turns upside down
:| 3x3.txt wins the 3x3 board
   \ can't check until a frown turns upside down
:| 4x4.txt wins the 4x4 board
   \ can't check until a frown turns upside down

Here's my code: https://pastebin.com/9redrKh2

1
  • The code which is already provided by CS50 writes the board to a file, so make sure you didn't change any of that code. That might be causing the problem because the message says file length is less than expected. – akshayk.vnit Jul 19 '17 at 18:03
1

It is not complaining about the compile, that gives a :). It is complaining that the board is not initialized correctly.

  1. Remember from the check50 section of the spec:

Note that check50 assumes that your board’s blank space is implemented in board as 0; if you’ve chosen some other value, best to change to 0 for check50's sake.

  1. It looks like you have modified the log file output (changed the print specification from "%i" to "%2i "). check50 uses the log file output to assess correctness. It doesn't verify because the output file size is not correct.

There may be other problems with the code, that will be discovered after check50 gets through the initialization tests. Any such should probably be a new question.

1
  • Yes, that's true. I changed the board's blank space to 0 and also changed the log file print output to %i, and that got CS50 to correct some of the problems. And yes, I have new challenges. Check50 now tells me that: timed out while waiting for "Illegal move.". Can you help me, please – Hubert Jul 31 '17 at 16:15

Not the answer you're looking for? Browse other questions tagged .