# Does writing computer code and letting a machine solve a puzzle really count as solving a puzzle?

I was really having a good time trying to solve this beautifully constructed puzzle:

fill this grid with water!

As with any puzzle, I was working on it manually - running probabilities and trying scenarios - and ruling things out in a logical progression. I was getting close...

And then the solution was posted. At first I was impressed. But then I noticed that the solver simply wrote some computer code based on boolean values and logical constraints, and let A MACHINE do all the work. Computers can do in mere seconds the kind of processing that would take us days (if not longer) to complete.

Here's my question: is this a legitimate way of solving a puzzle?? As a software developer myself, I could have easily written a function to solve, but that wouldn't be nearly as fun as trying to solve manually, and it seems like cheating to me. It's like using an anagrammer program while playing Scrabble. Kind of defeats the purpose...

What do you guys think?? I'd love your feedback...

• This depends on the purpose of challenges here I think. If the idea is to find an answer, then I don't see any problem. If the point if fun, then it's a bit different, but people can still have fun with it by not looking at the answers beforehand. Either way, I can't think of a way to ban it, since you could just as easily solve it with a computer and not tell people that. – Set Big O Dec 16 '14 at 16:28
• I don't have enough brainpower to right a full answer right now, but I basically thing that solving by brute-force is OK but an accepted answer should have to explain the theory behind it and why their solution is correct. "Because my program said so" is not a suitable reasoning for Puzzling.SE – Joe Dec 16 '14 at 16:43
• I think that often, when code is written to solve a puzzle, the puzzle involved is figuring how to write the code. And as AE said, it often depends on the questioner's intent – For I In Range Dec 16 '14 at 16:43
• I also think that writing a suitable code is a very valid form of solving the puzzle. In particular, if specific code had to be written. A good answer with brute-force tells about the ideas behind the code and/or makes it available. Giving some details and not just a link to source could make it even better. – BmyGuest Dec 16 '14 at 17:01
• @ForIInRange that'd be valid if this was SO or PPCG or something, where the focus is on computing. Here, the focus is on puzzling and a correct answer should address the problem from a puzzling standpoint. By all means use a program to help you understand it, and work it out, but the accepted answer should explain the puzzle and its solution – Joe Dec 16 '14 at 17:02
• @wildBillMunsion: By all means, if your own (partial) solution contains reasoning you can put into words and examples and you exercise the solution through, I would for sure up-vote that and recommend it should become the accepted solution! – BmyGuest Dec 16 '14 at 17:15
• OK I will continue working on the solve manually and post when complete. Thanks!! – wildBillMunson Dec 16 '14 at 17:51
• SE is all about answers. As long as the correct answer is posted, then it should be allowed, no matter what method was used to obtain it. – pacoverflow Dec 17 '14 at 0:07
• I asked something on puzzling.stackexchange.com/questions/3651/… along these lines. In that case the question asked for the lowest number that could not be solved which needed computer verification to prove that any answer couldn't be solved. This is basically an anecdotal way to say that computers programs can be useful in some situations.. – Chris Dec 23 '14 at 14:03
• @pacoverflow: Suppose I'm trying to write a program that prints all the integers from 1 to 100, and I ask about it at SO. If someone posts a link to a binary executable that does that, they've posted "the correct answer", but it's useless. You can't learn from it, you can't modify it, you can't port it to a different platform or language -- it's garbage. Likewise a puzzing.SE answer that only gives the answer, with no explanation of why it's the answer. – ruakh Dec 28 '14 at 20:03
• @ruakh Yes, as long as a correct answer has an explanation, it is allowed on SE. Link only answers are not acceptable. – pacoverflow Dec 28 '14 at 20:08
• @pacoverflow: Set aside the "link only" part. I said "a link to" just because StackExchange doesn't let us incorporate binary blobs into answers, but supposing it did. The answer is garbage. Do you really not see that? – ruakh Dec 28 '14 at 20:11
• @ruakh Of course it is garbage. I never said an executable file is an acceptable answer. I only said that we should allow answers on Puzzling that show source code that can be used to solve the question (along with an explanation of what the code does exactly, of course). – pacoverflow Dec 28 '14 at 20:17
• @pacoverflow: An executable file on Stack Overflow (where we're interested in the source-code, not just running the program) is analogous to a code-only answer here (where we're interested in puzzles that humans can solve, not "puzzles" that computers can solve for us). Writing a program is a great way to explore a puzzle and its solution, but if the only outcome at the end is "I don't really know why this is the answer, except that my program produced it", then it's a bad answer. – ruakh Dec 28 '14 at 20:22
• @ruakh If a person is capable of writing a program to solve a puzzle, then I'm not sure why that person wouldn't be able to explain how the program determined the solution. Regardless, I think there is value in showing people that some puzzles can be solved programmatically, even if there are non-programmatic solutions. People are always free to upvote/downvote the answers that they like/dislike. – pacoverflow Dec 28 '14 at 20:36

This is more a long commentary with some thoughts about this than an answer.

I already used that in puzzles that seemed to be too hard or too boring to be manually solved. Frequently I use this as a last resort when everything else fails.

Should we forbid that? Perhaps, but this may simply not work, at least not in every case. If someone post a computer generated solution and says that it is manually generated, how to prove to the contrary?

Further, if people are trying computer generated solutions, this could be a sign that the puzzle is too hard or require too many power from our poor human brains.

And of course, there are some puzzles that can't be really solved without resorting to these or are even designed expecting people to use those.

And again, computer generated solutions are normally inferior to manually generated ones. Why? Because in a manual solution, you can (normally) explain in detail what logic steps you taken to reach the solution, but this is rarely possible in a computer generated one, specially if brute-force (i.e., it just blindly tries all the millions possible combinations until finding the correct one). So if there are two equally valid answers, one computer-generated and the other detailed and manually-generated, it is expected that the manually generated get more upvotes and is more likely to be accepted.

And about the fun, creating the program to find the solution is a valid skill in puzzle-solving. You might say that it is not expected at least in some cases, but it is valid nevertheless. Further, as @A E said in a comment below:

If I can see the algorithm (source code or pseudo-code) then that's often clearer (to me) than a plain-English explanation of the method.

Nothing wrong with first 'cracking' a puzzle and then thinking how one could have arrived there with logic alone...

I totally agree with that.

So what to do? Creating puzzles that needs human brain-power instead of just juggling bits around until it fits is a good start. Except, of course, if you see no problem with that.

• I wouldn't say that the manually created one should be upvoted (see my answer below), but that the one which gives better explanations should. Nothing wrong with first 'cracking' a puzzle and then thinking how one could have arrived there with logic alone... – BmyGuest Dec 16 '14 at 16:59
• re "in a manual solution, you can explain in detail how you reached the solution, but this is rarely possible in a computer generated one": I'm not sure I agree. If I can see the algorithm (source code or pseudo-code) then that's often clearer (to me) than a plain-English explanation of the method. – A E Dec 16 '14 at 17:04
• @BmyGuest Edited. What do you think about now? :) – Victor Stafusa Dec 16 '14 at 17:35
• @AE Edited. What do you think about now? :) – Victor Stafusa Dec 16 '14 at 17:36
• Better. But I'd given you +1 already before ;c) I would love to give this question as a reference of a good answer - but now it closed... (and your answer not visible) – BmyGuest Dec 16 '14 at 17:37
• If people are trying computer solutions it could also be because they are better at writing programs than solving puzzles. Certainly the question I answered this way was because I thought it would be an interesting coding challenge and once done I figured I might as well actually answer too (especially considering existing answers were incorrect). – Chris Dec 23 '14 at 14:05

I know what you're saying, wildBillMunson.
In fact, I was in the identical situation for the identical puzzle.

To answer/discuss your questions, I think one has to go back on what this site is about, and what it isn't. While a lot of the fun from this site obviously is rooted in the fun of cracking codes and doing this in a competition like manner, it is not the main purpose of this site.

Puzzling.SE is not a puzzle repository or challenge site, and as a result there is nothing to win or loose, just to learn and teach.

Having this in mind, any solution to a challenge which was derived by any means, is a worthwhile addition and does not spoil anything. In fact, it is the sole purpose of the spoiler tags to prevent this!

However, I do think that we should try to concentrate on good answers rather than fast answers, and that we should - as OPs or as voters - honour this in our actions. What I mean by this is:

Start accepting and up-voting the best answers - the ones which teach & explain

There is also nothing wrong about changing the accepted answer, if a better comes along. So, to directly answer your posted question:

Solutions gained by brute-force are fully acceptable on site, but answers which can give additional information should be the ones accepted/upvoted, regardless of their posting time.

That's only my opinion of course, so feel free to differ.

It's perfectly fine!

Think about it. The main counterpoints are

1. It ruins the fun
2. It's unfair to other solvers

But those are weak arguments, it can only ruin the fun for the other solvers if they look at it, instead of solving.

As for it being unfair, It's again, only unfair if the solver don't get a chance to try. Besides, the human answer is more likely to be accepted, due to the easier explanation of how the answer was achieved.

You don't have to look at other answers if your solving it for yourself!

If you wanna have fun solving it on your own time, don't look at the answers. That simple.

Besides, how would we ban this?

There is simply no way to prove someone computed the answer unless they say so.

So it's okay, and even if it weren't, we can't stop it!

Let puzzle writers prohibit coding

There's lots of fun types of puzzles that can be trivialized by a computer program: cryptograms, sudokus, logic puzzles, and totally original puzzle types with a well-specified structure. That doesn't make a puzzle bad. If the poster believes that computer solving would ruin the puzzle, they should say so, and solvers should respect it. If they don't say anything, feel free to code away.

Someone can still post a computer-found solution, but it should be understood that it's not a real solution in the spirit of the puzzle.

As a tangential suggestion: puzzle writers should say if they think their puzzle requires coding to solve, so that those who aren't interested in coding or don't know how to don't waste time fruitlessly trying to solve it by hand.

That's a really interesting question.

I think that it depends on the intent of the puzzle-writer.

I'm quite happy for anyone answering any of my puzzles to use any resources that they have - including Google, programming tools, etc - and in fact to solve some of my puzzles it's necessary to do that.

But I can imagine that other people might want to write puzzles where you're meant to solve them using your brain. Directly. Rather than using your brain to write a program to solve it. :) I'd suggest that in those cases the puzzle-author add a "rule" that solvers are on the honour-code to solve it just using their own brains.

We're having an interesting discussion about how to compose puzzles to make computerised solving harder (or easier): The strength of ciphers against brute force methods - what makes it more difficult but keeps it fair for humans? Clearly there are things that a puzzle-author can do to make the problem less (or more) suitable for automated solving - it's a really interesting subject (to me). This will obviously be more effective with some classes of puzzle than with others!

I might suggest a tag computer-generated-answers with the description stating that the puzzler is willing to accept answers generated by a computer or with assistance by a computer. This should serve to guide answerers by its presence/absence.

• We already have a computer-puzzle tag, although its meaning is broader than this. More to the point, we have a no-computers tag, whose absence is generally assumed to mean (barring a clear statement to the contrary) that the use of computers is acceptable. – Rand al'Thor May 25 '18 at 0:55