36

After receiving a question ban (not answer ban), I've been using dreamincode.net to get answers, but haven't got the same quality. So I decided to try to get my question ban lifted. I've answered a few questions helpfully, gained some reputation, and edited some of my down-voted questions.

Specifically, this question. Initially, it was a question where I dumped my code and basically asked why it wasn't working, which wasn't helpful to the community. It got a score of -4. About two weeks ago, I edited it to explain what I'd tried, etc., according to a comment I received on it. Today I edited it to remove the irrelevant code.

My question is, once I edit it, how does the algorithm know that it's a "better" question? Are the people that initially down-voted it expected to revisit it to remove their down-vote?

10
  • 13
    I took a quick look at the linked question. "it just works wrong" is not a good problem description because it does not give enough data to start a debug session. You got lucky and someone saw the problem by code inspection. You could greatly improve the problem description by giving the input values for the smallest board array you have found to fail, your result, and the result you wanted. Ideally, wrap the initialization for a failing case with the function you are debugging in a small program that is ready to run. Commented May 9, 2015 at 13:24
  • 1
    Your edited question is much better, but it looked like a wall of text. I edited it a bit to show you how to make it more readable with some formatting. Commented May 9, 2015 at 13:28
  • @PatriciaShanahan- I'll add some comparison pictures between how an initial configuration progresses in mine vs. Golly. Commented May 9, 2015 at 13:33
  • 13
    Pictures are almost always less useful than array element values in a form that can be copy-pasted into a program in the relevant language. An SSCCE is the most useful of all. Commented May 9, 2015 at 13:38
  • @PatriciaShanahan the original post contained an SSCCE, it didn't have any code not required to see the result. Besides comments, almost all that code was necessary. Commented May 9, 2015 at 13:46
  • 4
    I decided to help you by upvoting that question because you've shown your effort.
    – user3453226
    Commented May 9, 2015 at 13:49
  • 12
    The first "S" in "SSCCE" stands for "short". Almost always, the code wrapping the problem code in an good SSCCE will be specially written code that only exists to demonstrate the problem. Commented May 9, 2015 at 13:54
  • Oh. I'll see what I can put together. Commented May 9, 2015 at 13:55
  • 12
    The original post was not a SSCCE. A SSCCE would for example first declare a specific 3x3 board, then call either the function giveLive, takeRuthlessly, or countNeighbors on this board (depending on which function you had previously determined gives the wrong result with that particular input), and then print the result, along with the expected result. All other code can be removed. Ideally even the particular function that causes the problem can be shortened further to the bare minimum that still runs with the example input and exhibits the bug.
    – HugoRune
    Commented May 9, 2015 at 13:56
  • Ok, now I get it @HugoRune Commented May 9, 2015 at 14:01

2 Answers 2

41

Posts on the front page are sorted by activity: Editing the question or an answer, or adding a new answer, will cause the question to appear at the top of the front page again.

This will cause other users to see the question, allowing them to vote on it or answer it. Previous voters will not be automatically notified, and there is no automatic judging on wheter the question has improved. To raise the score of the question, you need to gather votes from the new viewers. Beware though, if the question is not up to their standards, they may still downvote it.

Editing solely in order to push a question to the front page is frowned upon however. Make sure that the edits actually are meaningfull, and improve the question.


For your specific question:

As it is now, it is still a pretty poor question. One huge paragraph of text, and then a still quiete huge code block. The problem is not very well-defined, you mention 'golly' without any explanation on what it is, etc.

As I was writing this, @Lucas Trzesniewski has improved upon the formating quite significantly, but the content could still use some work.

I would suggest specifying your problem more clearly; e.g. what output do you expect, what output do you get, what is your input, what is "golly".

Then try to narrow your problem down to the actual function or code snippet that does not behave as you expect. People should be able to answer your question because they have more expertise than you, not because they are willing to invest more time debugging than you.

Also, the title "more problems with game of life" is really bad, and it is the first and perhaps only thing most readers will see. The title should summarize the problem you have, and definitely not reference any previous question of yours; with the number of new questions per minute, the chances that a reader remembers your previous questions are slim to none.

Regarding shortening the code to a SSCCE:

A SSCCE could, for example, first declare a specific 3x3 board, then call either the function giveLive, takeRuthlessly, or countNeighbors on this board (depending on which function you had previously determined gives the wrong result with that particular input), and then print the result, along with the expected result.

All other code can be removed, you only need the one function that causes the problem. Ideally even that particular function can be shortened further to the bare minimum that still runs with the example input and exhibits the bug.

It is possible that the resulting example will no longer have much in common with the game of life. That is a good sign though: your particular problem is not really related to the game of life anyway. For example someone implementing morphological dilation will have the same problem.

This way, perhaps some future reader having a similar problem with in-place modification of arrays will find your question and be able to apply the answer.

8
  • Thanks. Changed the title, explained what golly is. I think I'll link to the full code instead of pasting, Commented May 9, 2015 at 13:51
  • 3
    @LukeTaylor: do not hide your code off-site. As it is now, in your question, it is still on the long side but ok.
    – Mat
    Commented May 9, 2015 at 13:53
  • @Mat Ok, thanks. I won't. The previous code was actually run-able, this isn't, which was why I thought it might be good to give access to something. Commented May 9, 2015 at 13:54
  • @LukeTaylor: that's ok too, as long as the question contains enough code to actually answer it.
    – Mat
    Commented May 9, 2015 at 13:55
  • @Mat I was thinking of the SSCCE thing. Commented May 9, 2015 at 13:57
  • 2
    I was going to add an answer expanding on the difference between a code dump and an SSCCE, but this answer now covers it well. I would only add that, even for very experienced programmers who can find their own bugs, creating an SSCCE is often a useful debug step. It is something you should do for your own use before asking a debug question, not just as part of question construction. Commented May 9, 2015 at 14:21
  • 21
    "People should be able to answer your question because they have more expertise than you, not because they are willing to invest more time debugging than you." I need many sockpuppets to upvote you for that.
    – Braiam
    Commented May 9, 2015 at 18:42
  • @LukeTaylor: There's no problem with linking to the full program off-site. It won't usually help very much, but it doesn't hurt. If the question contains an MCVE, makes it clear what the question is, and describes enough to make it obvious that this isn't an XY problem, the only good reason for anyone to look at your full program is curiosity. But encouraging potential answerers' curiosity isn't a bad thing, so go ahead and link. Just don't expect doing so to solve any problems remaining with your question.
    – abarnert
    Commented May 10, 2015 at 2:10
6

Although there is an excellent existing answer, the OP's confusion about the amount and type of code to post is a common one. This answer is a worked example of turning the posted code in the original question into an SSCCE. Please excuse, and edit to fix, any errors of Python style - I am not a Python programmer.

I made no changes to the neighbors function, so I won't copy it here. I made a couple of changes to the rules implementation - I turned it into a function and deleted the calls to the display methods that the OP indicated were working.

def runrules():
    #Manage the rules of the game
    for r in range(len(board)):
        for c in range(len(board)):
            neighborcount = neighbors(r, c)
            if board[r][c]:
                if neighborcount < 2 or neighborcount > 3:
                    board[r][c] = False
            elif not board[r][c]:
                if neighborcount == 3:
                    board[r][c] = True

Finally, I needed to pick a failing example - this is perhaps the most important omission from the original question. I chose the first iteration of the Blinker oscillator. It uses most, though not all, of the rules and can be demonstrated on a 3x3 board given the way this program handles the edges. I wrote a main program that initializes the board, prints it, does one step, prints the actual result, and prints the expected result:

thesize = 3
board = [[(i==1) for j in range(thesize)] for i in range(thesize)]
print "Input board:"
print board
runrules()
print "Actual:"
print board
print "Expected:"
print "[[False, True, False], [False, True, False], [False, True, False]]"

The output was:

Input board:
[[False, False, False], [True, True, True], [False, False, False]]
Actual:
[[False, True, True], [True, False, True], [False, False, False]]
Expected:
[[False, True, False], [False, True, False], [False, True, False]]
1
  • Thanks a lot, great help with the question, voted up. Not accepted due to the fact that the previous answer answers the question of how edited posts are recognized. Commented May 10, 2015 at 2:22

You must log in to answer this question.

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