9
\$\begingroup\$

I'd like feedback on this challenge I posted which was closed as unclear.

Make (a ==1 && a== 2 && a==3) evaluate to true?

One issue raised was the vagueness of "reasonably equivalent to". I was just trying to communicate $a == 1 for PHP, or a == 1 for JavaScript, so on. I know that different languages handle conditionals different. Is there a way I could phrase this requirement in a more strict way? Perhaps "Must do an equality comparison on a variable integer of 1, to integer of 2, and to integer of 3, in the same conditional"?

Another issue raised is that some languages do not involve if statements or Boolean. If I'm more clear that the language must support these concepts, will it be allowed, or does a challenge need to specify a language or support all languages?

Also, I heard this is an Underhanded challenge, which is not allowed. I haven't found a hard definition on it, but I did find this discussion on it and understand the general idea that it's a question that is tricky. Can someone provide a solid definition. Can this challenge can be made to not be Underhanded?

Is this challenge salvageable?

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ My intuition tells me that "reasonably equivalent" to is going to be next to impossible to define well. \$\endgroup\$ – Ad Hoc Garf Hunter Jan 17 '18 at 15:03
  • \$\begingroup\$ @HeebyJeebyMan could I say "exactly equivalent"? Could I saw "must do an equality comparison on a variable to equal 1, to equal 2, and to equal 3, in the same conditional"? \$\endgroup\$ – Goose Jan 17 '18 at 15:05
  • \$\begingroup\$ What does "in the same conditional" mean? \$\endgroup\$ – Adám Jan 17 '18 at 15:07
  • 1
    \$\begingroup\$ That is going to be hard, && is easy enough to define, it takes two booleans and behaves on them in a predictable manner (however that might eliminate some potential) but == will probably snag you. The only property of == that we can really nail down is that it takes two things and returns a boolean. Operating under that defintion makes this no longer a challenge because now you are just making a binary operation that always returns true. We can try to make stricter definitions but they will probably remove most reasonable methods of solving the problem. \$\endgroup\$ – Ad Hoc Garf Hunter Jan 17 '18 at 15:08
  • 6
    \$\begingroup\$ Defining features of programming languages is really hard. Seriously. We've been trying to nail down what a "function" is for at least 3 years, and we still run into problems. This is why we like observable behavior. If you can define your problem in terms of input/output, or based on the bytes in the source code, then that's ideal. \$\endgroup\$ – Nathan Merrill Jan 17 '18 at 15:27
  • \$\begingroup\$ I also suspect that this challenge is not salvageable, but the way you have considered the problems with it suggests you will be a good source of well balanced challenges in future. \$\endgroup\$ – trichoplax Jan 25 '18 at 19:47
  • \$\begingroup\$ Perhaps to make it clear to those that may have missed it, the question is from SO a couple days before this was posted: Can (a ==1 && a== 2 && a==3) ever evaluate to true? (This may have been mentioned in the question post itself but as it's currently deleted I can't tell) \$\endgroup\$ – user52452 Jan 26 '18 at 1:40
  • \$\begingroup\$ @NickA it is indeed mentioned there. \$\endgroup\$ – Rɪᴋᴇʀ Jan 29 '18 at 16:24
7
\$\begingroup\$

I think that the biggest issue with the challenge is the part where it's . The simple definition for the underhanded tag is

An underhanded challenge is a challenge to write a program that looks as if it is doing one thing, but does something else.

And I think that there's no way to avoid that. (a == 1 && a == 2 && a == 3) looks like it should be false, and the challenge is to make it true, thus underhanded. Underhanded challenges have been determined to be off-topic here, so even with the other problems fixed I don't think it would be allowed.

| |
\$\endgroup\$
  • \$\begingroup\$ Understood. I'm not a very active user, but I'll say I think that's a shame, because I think questions like this can show amazing language features and creative programming, but that's a different discussion. My question does fit perfectly in that definition. \$\endgroup\$ – Goose Jan 17 '18 at 15:28
  • 3
    \$\begingroup\$ @Goose There were two primary reasons we don't really like underhanded. First, we use to have quite a few of them, and after a while, nearly every answer was using the same tricks as before. The second reason is because many of the questions were broad and poorly defined. It's really hard challenge to write well, and really appealing to first-comers. \$\endgroup\$ – Nathan Merrill Jan 17 '18 at 15:33
4
\$\begingroup\$

I would recommend you to check The Sandbox post and propose your challenge there before posting it on the main site. There you'll get feedback and suggestions that'll help you avoid this exact problem.

Regarding your questions, as HJM commented, "reasonably equivalent" is kind of hard to define well enough. As to the language restriction, I recommend you read this answer. I'll leave it to someone more experienced than me to answer the question regarding the Underhanded tag, since I myself get confused by it.

| |
\$\endgroup\$
  • \$\begingroup\$ It can be frustrating posting ideas to the sandbox to find that even after amendment they are just not suitable. To counteract this, I take the approach of posting lots of ideas to the sandbox, and then working on the ones that get a positive response or ways of making them fit the site. Then the ones that don't work out don't seem such a loss. \$\endgroup\$ – trichoplax Jan 25 '18 at 19:43

You must log in to answer this question.

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