0

guys my game of fifteen is showing errors in check50 please help here's my pastebin link http://pastebin.com/TgA030A5

check50 2015.fall.pset3.fifteen fifteen.c
:) fifteen.c exists
:) fifteen.c compiles
:) init initializes 3x3 board correctly
:( init initializes 4x4 board correctly
   \ expected "2" character 5 of line 4, not "1":( 3x3 board, move blank up twice
   \ expected prompt for input, not exit code of 0
:( 3x3 board, move blank left twice
   \ expected prompt for input, not exit code of 0
:( 3x3 board, move blank left then right
   \ expected prompt for input, not exit code of 0
:( 3x3 board, move blank up then down
   \ expected prompt for input, not exit code of 0
:( 3x3 board, move up-up-left-down-down-left-up-up-right-down-down-right
   \ expected prompt for input, not exit code of 0
:( 3x3 board, from start try to move tile 2, 4, 5, 6, 7, 8
   \ expected prompt for input, not exit code of 0
:( 3x3 board, move blank left (tile 1) then up (tile 4), then try to move tiles 1, 2, 6, 8
   \ expected prompt for input, not exit code of 0
:( 3x3 board, move blank up (tile 3), then try tile 2
   \ expected prompt for input, not exit code of 0
:| 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

https://sandbox.cs50.net/checks/76f3436883404aa7aba11405342f6b7c

0

For this pset, it's best that you try playing it yourself so you can see where the bugs are. As you can see, check 50 isn't always very helpful.

  1. For one thing, and this list isn't exhaustive so you really need to play with your game of 15, you aren't initializing the board correctly either for the case when there are an even number of tiles, or for when there are an odd number of tiles (in fact, you omit this case altogether).
  2. Your draw function isn't drawing the board.
  3. While not fatal to your code, you can track the position of the blank tile more efficiently instead of looking for it each time you call move by keeping track of its position.

You must log in to answer this question.

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