I really wish this article explained the syntax used for us J noobs.
In fact I can’t find an explanation of this puzzle that doesn’t use J, which is a shame - as explained the puzzle seems unsolveable to me, I’d like to knoe what I’m misunderstanding.
I took the lazy approach and pasted some of it into ChatGPT. The relevant syntax fact for me is that the modulus operator has its operands swapped, compared to the more familiar syntax: m|n-s[n] means (n-s[n]) % m. Once I realized all the math was mod m, I could ignore the m| prefix and kind of limp along.
Granted, I still don’t fully understand why the solution works, but I could run it in Python and see that it does.
Vg jbexf orpnhfr gur fhz bs nyy gur ung ahzoref, zbqhyb a, vf ba gur bar unaq n tybony cebcregl vaqrcraqrag bs gur ahzore ba nal tvira ung; ohg, ba gur bgure, vs thrffrq pbeerpgyl qbrf gryy lbh jung lbhe bja ahzore zhfg or. Yrg hf pnyy gung fhz c. Vs rnpu bs a crbcyr thrffrf n havdhr bar bs gur a cbffvoyr inyhrf bs c, rknpgyl bar bs gurz zhfg or pbeerpg. Gur pyrire cneg urer vf gung nalbar jub vf evtug nobhg gur inyhr bs c pna pbzchgr gurve bja ung ahzore npphengryl. Fvapr jr ner thnenagrrq bar fhpu crefba, gurl qb gung, naq jr jva.
and the impossible chessboard puzzle is easy if you simply shoot the warden and steal the key, and that blue eyes island puzzle thing is easy if the islanders just build a raft
(Numbers on the hats do not have to be all different. People can not exchange any information during the procedure but can agree on some strategy beforehand.)
if you try you should see quite quickly that it doesn’t always work - for example if person 37’s hat says 2, and everyone else’s hat says 37
edit: sorry if I seemed a bit short. I thought your first strategy was in the same vein as the second one. The solution doesn’t require advanced technology, but it’s not quite that trivial; the puzzle should look impossible at first.
I really wish this article explained the syntax used for us J noobs.
In fact I can’t find an explanation of this puzzle that doesn’t use J, which is a shame - as explained the puzzle seems unsolveable to me, I’d like to knoe what I’m misunderstanding.
Hint: You have n shots. Try to find a property with n possibilities that’s invariant to the number on the guesser’s head.
Spoiler: Nffvta rnpu ung-jrnere n frdhragvny ahzore v sebz mreb gb a. Jura vg vf gvzr gb thrff, rnpu crefba nffhzrf gung gur fhz bs nyy gur ung ahzoref, zbqhyb a, rdhnyf v. Gurl jevgr qbja gur havdhr ahzore sbe gurve ung gung jbhyq znxr guvf nffhzcgvba gehr. Rknpgyl bar fhpu thrff jvyy or pbeerpg.
Oh, this is a great little puzzle. Thanks for the explanation.
I took the lazy approach and pasted some of it into ChatGPT. The relevant syntax fact for me is that the modulus operator has its operands swapped, compared to the more familiar syntax:
m|n-s[n]means(n-s[n]) % m. Once I realized all the math was mod m, I could ignore them|prefix and kind of limp along.Granted, I still don’t fully understand why the solution works, but I could run it in Python and see that it does.
Vg jbexf orpnhfr gur fhz bs nyy gur ung ahzoref, zbqhyb a, vf ba gur bar unaq n tybony cebcregl vaqrcraqrag bs gur ahzore ba nal tvira ung; ohg, ba gur bgure, vs thrffrq pbeerpgyl qbrf gryy lbh jung lbhe bja ahzore zhfg or. Yrg hf pnyy gung fhz c. Vs rnpu bs a crbcyr thrffrf n havdhr bar bs gur a cbffvoyr inyhrf bs c, rknpgyl bar bs gurz zhfg or pbeerpg. Gur pyrire cneg urer vf gung nalbar jub vf evtug nobhg gur inyhr bs c pna pbzchgr gurve bja ung ahzore npphengryl. Fvapr jr ner thnenagrrq bar fhpu crefba, gurl qb gung, naq jr jva.
the winning strategy is for person 0 to guess 0, etc.
the other winning strategy is to ask someone what your number is
and the impossible chessboard puzzle is easy if you simply shoot the warden and steal the key, and that blue eyes island puzzle thing is easy if the islanders just build a raft
Which is why the puzzle formulation should specify these things…
And the strategy would be “OK, I’m going to choose 0, you’re going to choose 1, etc”
if you try you should see quite quickly that it doesn’t always work - for example if person 37’s hat says 2, and everyone else’s hat says 37
edit: sorry if I seemed a bit short. I thought your first strategy was in the same vein as the second one. The solution doesn’t require advanced technology, but it’s not quite that trivial; the puzzle should look impossible at first.
[Comment removed by author]
[Comment removed by author]