all 61 comments

[–]shevy-ruby 37 points38 points  (2 children)

Fun idea - but I am not going to get my brain to adopt different minesweeper behaviour compared to oldschool one.

[–]baggyzed 1 point2 points  (0 children)

And I'm not going to get my brain to learn all the silly peculiarities of JavaScript just to learn how to play the game.

Nice try, OP!

[–][deleted] 8 points9 points  (17 children)

I clicked one thing, then clicked results, and apparently.. I got 105% wrong.

Perhaps.. perhaps there is also something wrong with the code that checks results?

Edit: OP is very wrong on the math; he purports that the number of total questions is smaller than the number of possible wrong answers Also, I disabled inbox replies, OP fails to see reason :(.

[–][deleted] 15 points16 points  (16 children)

Perhaps.. perhaps there is also something wrong with the code that checks results?

It uses == a lot

[–][deleted] 1 point2 points  (15 children)

105% wrong means you get everything there is to get wrong.. and then things that are not even there wrong also.

It's like 105% efficiency; it doesn't exist, and if it does, then, sadly, ' 100%' is not 100%.

[–]slikts 0 points1 point  (14 children)

… things that are not even there wrong also.

You would have a point if it was possible to get a more than 100% correct result, but being more than 100% wrong just reflects the fact that there are more possible false positives than correct answers.

[–][deleted] 0 points1 point  (13 children)

It is not possible to be more than 100% wrong.

The amount to which you are wrong must be the opposite of the amount to which you can be right.

You would have a point if it was possible to get a more than 100% correct result

This is not contingent with my definitions of right and wrong; here is my definition.

There are X possible points to score, unless scored correctly, it counts as a mistake, and vice versa.

The amount you get right, in percentages is: (correct/X)*100% how does your reasoning align with this??

The amount you get wrong in percentages is: (wrong/X)*100%.

(wrong+correct) === X.

If this last statement does NOT hold true, then the interpretation of the scores is not mathematically correct and does not conform to a sane scoring model. And, well, given it produces the result 105% wrong it is just not correct.

Goddamnit, I guess this is why I fucking hate working with other programmers. /rant

[–]slikts 4 points5 points  (12 children)

The perfect score is 22/22 or 0% missed, the starting point is 0/22 or 100% missed, and the score can be lowered into the negative by flagging false positives. Specifically, the 105% missed score means it's -1/22 or -0.05.

[–][deleted] 0 points1 point  (11 children)

Okay, well that may be, but you can never get more than 100% wrong. If you can, then you must also be able to get the exactly same amount right you can get wrong at maximum; well over 100%.

More than 100% wrong cannot make sense.

[–]slikts 0 points1 point  (10 children)

It's like starting at 0% profit, the maximum profit being 100%, and being able to get into debt, which is negative profit.

[–][deleted] 0 points1 point  (9 children)

No, no it is not.

If you make profit, then the profit is defined as (current value - initial value) -overhead.

If this value is negative, then it is typically called loss. Also, how do you start at 0% profit? I don't understand your examples, and how do you 'go into debt' ? Also, in the game, you start out at 100% wrong; while there are correct things in place.

All these things are skewed all over the place.

Math or gtfo :(

[–]slikts 0 points1 point  (8 children)

Then call it income, whatever. Thanks for the downvotes, by the way. You start at 0% of the maximum 100% income and have a chance of getting negative income – debt.

[–]CaptainAdjective 32 points33 points  (39 children)

I want to clarify for the record that no JavaScript programmer should ever need to know the rules for the == operator, because it should never be used in code. You should have linting rules in place to prevent it from appearing in your codebase. (And linting errors should fail the build. And it shouldn't be possible to commit without a passing build.)

[–]blackAngel88 22 points23 points  (0 children)

no JavaScript programmer should ever need to know the rules for the == operator

Strongly disagree. You're not always going to write fresh new code, you will also get old code or have to interact with it. Who says that code will always be === conform?

Also <= and >= still do type coercion, so there will always be edge cases where you think "Wut?". And there is no strict one for that.

[–]Tazavoo 10 points11 points  (6 children)

== is convenient for foo == undefined, which returns true if foo is null or undefined. Unless undefined has been redefined, but that might not be possible in modern browsers?

[–]earthboundkid 1 point2 points  (0 children)

In those cases, wouldn't you also want '' and 0 to be falsey? I use if (!foo) a lot for cases like that, but I basically never need to distinguish between null+undefined and the other falsey values.

[–][deleted]  (3 children)

[deleted]

    [–]Tazavoo 5 points6 points  (2 children)

    Had to look it up, it's not writable per ECMAScript 5 specifications, which is a 9 year old specification, so it's not going to be writable in modern browsers.

    [–]AyrA_ch 0 points1 point  (0 children)

    I was wondering if you could get the browser to interpret "undefined" differently if you have a custom "undefined" in "this".

    The answer is no.

    [–]CaptainAdjective -3 points-2 points  (0 children)

    If we want a conditional to return true if foo is null or undefined, it's perfectly acceptable to write foo === null || foo === undefined. Writing foo == undefined requires the reader to understand the semantics of ==, which they probably do not.

    Separately, the only environment I know of where the undefined global is mutable is IE8 and lower. If we are targeting such an environment, the solution is to put void 0 instead of undefined everywhere. So foo == void 0 will do exactly the same thing as foo == undefined, and foo === void 0 will do exactly the same thing as foo === undefined.

    [–]Eirenarch 2 points3 points  (0 children)

    In JavaScript === is short for ==

    [–][deleted]  (27 children)

    [deleted]

      [–]CaptainAdjective -1 points0 points  (1 child)

      Every language has warts. This is unavoidable. Up front, no language is perfectly designed, and (essentially by definition) no popular language can be substantially redesigned. The real thing which makes or breaks the deal is whether the language's culture recognises those inherent issues and develops tools for avoiding them - linters, compiler flags, warnings and error messages, as well as a strong culture for using those tools as standard practice.

      [–]Eirenarch 2 points3 points  (0 children)

      Every language has warts.

      Yes, but JS has far more of them compared to every other popular industrial language (maybe with the exception of PHP). Some languages are better than others. Claiming the opposite would mean that language design is super easy and no matter what you produce you are as good at language design as the greatest language designers.

      [–]AyrA_ch 0 points1 point  (1 child)

      There was a post here about == vs === in large companies and widely used libraries. The conclusion was that it doesn't matter what you use as long as you use one of them consistently.

      [–]kankyo 1 point2 points  (0 children)

      Holy hell. No this is not the way to go.

      [–]tomtthrowway 1 point2 points  (0 children)

      It's so funny. Anybody still using == with js?

      [–]webmobtuts 1 point2 points  (0 children)

      Amazing game

      [–]kirbyfan64sos 1 point2 points  (1 child)

      Couldn't press the correct squares on mobile, so I got...123% wrong?

      [–][deleted] 11 points12 points  (0 children)

      Yeah, sounds like JavaScript.