I am just finishing up the game of fifteen problem and went to use check50 to make sure everything was okay.

I got this error:

:( init initializes 3x3 board correctly
\ expected "0" character 5 of line 3, not "9"

This is because I set the value of my blank to be d*d (in the 3x3 board case this is 9) instead of 0 because I found it easier this way.

My question is this okay? I know I won't be able to use the check50 to make sure, but I am pretty confidant that everything works properly.

Everything worked fine when I checked using the winning code:

./fifteen 3 < ~cs50/pset3/3x3.txt

I just want to make sure this is okay to submit.



Not really. First, I believe the instructions say (at least they did when I solved it) to use 0 for blank because it's necessary for the check50 software to work. Remember, check50 is the same code that grades each pset, so it must pass check50.

Second, what happens when d==4 (or more)? The game board runs from 0 to 15 (or more). How would you distinguish between the blank 9 and the actual 9?

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • When it's 4x4, the blank becomes 16 because it is d*d. So it still works.
    – ddrossi93
    Apr 7 '17 at 5:03
  • It may still work,, but it will still fail check50 and therefore fail grading when submitted. At d>=4, it will fail worse because the generated log files won't be the correct size any more.
    – Cliff B
    Apr 7 '17 at 5:04
  • I see. Didn't realize that check50 answered it. Because I have to upload my code to github and it takes about a week for it to get graded. I figured someone was actually checking it
    – ddrossi93
    Apr 7 '17 at 5:05
  • Nope, if you're taking the online free class, it's only ever checked by check50. The only way that a person will check it is if you're paying tuition to Harvard for a credit class. And in that case, they'd ding you for not following instructions.
    – Cliff B
    Apr 7 '17 at 5:07
  • Got it. Just seemed odd that it takes that long to do if I can run it on my own in the IDE. Thanks for the response, I'll revise my code.
    – ddrossi93
    Apr 7 '17 at 5:09

You must log in to answer this question.

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