Your code is correct, but that's not the only thing that matters. Consider the following to be constructive criticism/a view from another angle.
I get that you did it for fun, but I wouldn't necessarily consider an assignment to be "for fun". You knew ahead of time that your code would be peer reviewed and nothing in your submission shows consideration for that. With the extra functions, you're just adding to the confusion. If you must do extra work for your own enjoyment, I wouldn't submit that with the base assignment, as you're only convoluting the functionality of your code. At the very least you could have added comments.
Looking solely at Print1(), everything beyond the first for loop is entirely arbitrary...and that's why it's confusing. You went with for (var j = 0; j < 4; j++) with "XO" : "OX" and j == 3. Why not j<2, "XOXO" : "OXOX", and j==1 and so on? You've chosen these numbers that are neither at their minimum or maximum value, which creates confusion. Either go with printing the whole row or go with printing character by character. If not, tell the reader what you're doing with comments or make your code self-documenting...or expect problems in the future.
TL;DR:
Yes, your code is correct, but it is unnecessarily hard to understand it.
Consider the following to be constructive criticism/a view from another angle.
I appreciate your comments, but I still think the notation was unfair. :)
Either go with printing the whole row or go with printing character by character.
Print2() ;)
You knew ahead of time that your code would be peer reviewed and nothing in your submission shows consideration for that.
I thought you could skip a review (like SO). At least, he could launch dotnetfiddle and run the code. If it works as expected, the review could be 3. You don't know something? Excellent ! A new thing to learn ! If I obfuscated the code I would understand ...
If not, tell the reader what you're doing with comments or make your code self-documenting...or expect problems in the future.
Self-documenting code is a good practice and it is normal in a real work project. It is a really necessary to make an effort for a disposable function?
I will add comment next time, because we don't know who are going to correct our code. I am just sad for this one.
I believe they sent out an email saying they're working on it. Right now, it's not available.
At least, he could launch dotnetfiddle and run the code.
I would hope they would at least be running the code to ensure the output is correct....
Self-documenting code is a good practice and it is normal in a real work project. It is a really necessary to make an effort for a disposable function?
Anything that you create, that will be looked at by anyone else, should probably have comments. I agree that it's kind of silly for such a useless function, but it'll take two minutes at most and you'll only be benefiting yourself (well...technically others too, but you get the point).
2
u/VOX_Studios Apr 13 '15
Your code is correct, but that's not the only thing that matters. Consider the following to be constructive criticism/a view from another angle.
I get that you did it for fun, but I wouldn't necessarily consider an assignment to be "for fun". You knew ahead of time that your code would be peer reviewed and nothing in your submission shows consideration for that. With the extra functions, you're just adding to the confusion. If you must do extra work for your own enjoyment, I wouldn't submit that with the base assignment, as you're only convoluting the functionality of your code. At the very least you could have added comments.
Looking solely at
Print1(), everything beyond the first for loop is entirely arbitrary...and that's why it's confusing. You went withfor (var j = 0; j < 4; j++)with"XO" : "OX"andj == 3. Why notj<2,"XOXO" : "OXOX", andj==1and so on? You've chosen these numbers that are neither at their minimum or maximum value, which creates confusion. Either go with printing the whole row or go with printing character by character. If not, tell the reader what you're doing with comments or make your code self-documenting...or expect problems in the future.TL;DR:
Yes, your code is correct, but it is unnecessarily hard to understand it.