jack: (Default)
[personal profile] jack
OK, so before the bizarre misunderstandings in my previous post, I had been going to repost question which I thought was an interesting logic puzzle in its own right.

You have five bags of holding. One contains a fabulous treasure. Two contain liches who can't escape until you open the bag. Two contain nothing.

You have a spell which tells you something about the result of a course of action you propose. (This description is slightly altered from the functionality of the original spell to make the puzzle work, feel free to ask for clarification as needed.)

"Weal" for good result (eg. treasure, no liches)
"Woe" for bad result (eg. 1+ lich, no treasure)
"Weal and Woe" for a good and bad result (eg. treasure and also lich)
"Nothing" for a result of no particular good or bad (eg. open no bags or only open empty bags)

Puzzle

What's the minimum number of castings of the spell needed? (I think 3 is easy and 1 is impossible, so basically, can you do 2?)

Clarifications

The course of action has to be 30 minutes or less.

We don't have specifics on how you define the course of action, ask if it needs to be more explicit.

Assume you can include other results in the plan if they help, eg. "if this bad contains nothing, I stab myself in the leg", without necessarily needing to follow through. (This is slightly more generous than the original spell.)

Assume you don't include the castings of further divination spells within the scope of the course of action considered by casting the first spell.

Follow-ups (may be unnecessary depending on the best solution to the original)

If you only have one casting, what's the greatest chance you can give yourself of finding the treasure whilst finding no liches.

The original restrictions of the spell say that if you cast it four times in a day (ignored for the basic puzzle), the second, third and fourth times have a 25%, 50% and 75% chance of giving a random answer. What's the highest chance you can give yourself of finding the treasure and no liches in up to four castings with those failure chances.

Previously we assumed you couldn't create a paradox. If you *can*, and causing a paradox causes the spell to fail to give an answer in a way distinct from "nothing", can you reduce the number of castings?

If you *can* ask about a course of action including further divination spells, does that help?

Does the answer generalise to a larger number of bags (assuming 1 treasure, N liches and N nothing)

ETA: Fix formatting.

Date: 2017-06-14 03:37 pm (UTC)
From: [identity profile] khoth.livejournal.com
If I open a bag and it contains a lich, can I continue to open another bag or do I need to stop to get murdered first?

Date: 2017-06-14 06:27 pm (UTC)
simont: (Default)
From: [personal profile] simont
But I'd be interested to know if you can avoid that being a problem

I think so, yes.

I solved this in my head while walking home. My initial solution, which does have the 'yes but what if liches are instantly fatal?' problem, went like this:

Lbhe svefg dhrel cebprqher vf "V bcra ontf bar naq gjb". Vs lbh urne "jrny", jvgu be jvgubhg "jbr", gura bar bs gubfr gjb ontf vf gur gernfher, fb dhrel #2 vf "V bcra ont bar" naq abj lbh xabj rknpgyl jurer gur gernfher vf. Vs lbh urne whfg "jbr" gura lbh xabj gur erznvavat guerr ontf vapyhqr gur gernfher naq _ng zbfg bar_ yvpu, juvpu zrnaf lbh pna hfr dhrel #2 gb nfx nobhg bcravat gubfr guerr ontf va fbzr cnegvphyne beqre, naq vs gur nafjre gb gung vf abg "jrny" gura bcravat gurz va gur bccbfvgr beqre zhfg or fnsr (orpnhfr gurer pna'g or n yvpu ba _obgu_ fvqrf bs gur gernfher). Gur erznvavat cbffvovyvgl vf gung lbh svaq bhg gung gur svefg gjb ontf ner rzcgl, v.r. gur erznvavat guerr ontf pbagnva gur gernfher naq _obgu_ yvpurf; va gung pnfr, dhrel #2 vf "V bcra bar bs gur erznvavat ontf, naq vs vg'f abg gur gernfher, V bcra n frpbaq bar"; gura nafjre "jrny" zrnaf gur gernfher vf va gur svefg ont lbh vzntvarq bcravat, "jrny naq jbr" zrnaf gur frpbaq, naq cynva "jbr" zrnaf vg'f va gur ont lbh unira'g zragvbarq ng nyy. Ohg gur zvqqyr pnfr bs gung ynfg cbffvovyvgl qbrf nffhzr gung bcravat bar ont naq svaqvat n yvpu fgvyy nyybjf lbh gb bcra n frpbaq ont.

A revised procedure which works even if liches are instantly fatal goes like this:

Lbhe svefg dhrel vf abj "V bcra ontf bar naq gjb, naq vs gurl ner obgu rzcgl, V bcra ont guerr". Abj vs V urne "jrny", gura V fvzcyl _qb gung_ naq jvyy trg gur gernfher. Vs V urne "jrny naq jbr" gura gur gernfher zhfg unir orra va bar bs gur svefg gjb ontf (orpnhfr V xabj ng yrnfg gjb bs gur guerr jrer aba-rzcgl, fb V jbhyqa'g unir bcrarq ont guerr naljnl), juvpu vf bar bs gur rnfl pnfrf sebz gur cerivbhf irefvba. Naq vs V urne "jbr", gura _rvgure_ gur yvpurf ner va ontf bar naq gjb – va juvpu pnfr vg qbrfa'g znggre jung beqre V bcra gur erznvavat guerr va – be ryfr bar bs gur yvpurf vf va ont guerr, va juvpu pnfr V chg ont guerr va gur _zvqqyr_ bs gur beqre gung V nfx nobhg va dhrel #2, naq gung thnenagrrf gung V pna'g cbffvoyl eha vagb gur bar qnatrebhf beqre (yvpu,gernfher,yvpu) jubfr erirefny vf _nyfb_ qnatrebhf.

However, a final quibble: this still assumes something about the nature and behaviour of liches, namely, that they are either instantly fatal or have no short-term effect at all. I think there may still be trouble if the effect of freeing a lich is that it instantly mind-controls you and forces you to open all the remaining bags (including its mate and the treasure) and then swans off leaving you alive – because in that situation there is no way you can get the answer "woe" at all, and your information is much reduced!

Date: 2017-06-15 10:43 am (UTC)
ptc24: (Default)
From: [personal profile] ptc24
So, assuming you're a lich that's just about to be stuffed into a bag of holding in order to be included in one of these puzzles, and you can credibly precommit to taking various courses of action (which you will then definitely follow through on) - what might you want to pre-commit to?

Date: 2017-06-15 10:49 am (UTC)
simont: (Default)
From: [personal profile] simont
So, assuming you're a lich-hunter who stuffs liches into bags of holding and sells them to logic-puzzle setters and hypothetical-situation manufacturers, this is why you have to sneak up on your target and render it unconscious instantly without giving it enough advance warning to precommit to anything :-)

Date: 2017-06-15 12:02 pm (UTC)
ptc24: (Default)
From: [personal profile] ptc24
Presumably lich = genie + devil - fairy.

So with genies and fairies, any deals you do, you have to have your wits about you lest you end up with a comedically bad deal, but the deals aren't tragically doomed in the way that deals with the devil are.

Date: 2017-06-15 11:03 pm (UTC)
ilanin: (Default)
From: [personal profile] ilanin
"I will help them locate the treasure and then leave them unmolested for a period of 30 minutes. In the 31st minute, I shall kill them and steal the treasure."

Date: 2017-06-14 03:48 pm (UTC)
simont: (Default)
From: [personal profile] simont
What's the minimum number of castings of the spell needed?

Preliminary pedantry: needed to achieve what goal? You don't actually say! :-)

I assume your implied goal is 'glean enough information to be reliably able to open the bag of treasure without opening any bags that let liches escape', but you do actually have to say it. Otherwise I might maliciously assume that 'avoid liches' is an adequate goal (in which case zero castings suffice and I simply walk away from the whole lot), or 'reduce probability of liches to below some threshold value', or 'maximise expected utility given some additive cost function'... :-)

Date: 2017-06-14 03:56 pm (UTC)
From: [identity profile] khoth.livejournal.com
I think it can be done in two. I'm assuming here that if you open a lich you have to fight it and that's bad, but that it doesn't disrupt your plans beyond that.


Cyna sbe svefg pnfgvat: Bcra ont bar. Vs vg'f gernfher, gnxr vg naq yrnir. Vs vg'f abg gernfher, bcra ontf gjb naq guerr. Vs gurer'f gernfher naq lbh unira'g sbhaq n yvpu, xrrc bcravat hagvy lbh qb.

Fgngr nsgre svefg pnfgvat: Gernfher va ont bar: Jrny. Gernfher va ontf gjb be guerr: Jrny+Jbr. Gernfher va ontf sbhe be svir: Jbr

Cyna sbe frpbaq pnfgvat, vs gur gernfher jnfa'g va ont bar: Bcra ont gjb (be sbhe). Cerggl boivbhf ol guvf cbvag.

Date: 2017-06-14 03:58 pm (UTC)
From: [identity profile] khoth.livejournal.com
This isn't optimal in expected number of casts required, but I have actual work to do.

Date: 2017-06-14 04:29 pm (UTC)
From: [identity profile] khoth.livejournal.com
I'm not sure if it's impossible to do it in one cast, but I don't have an actual method. My thoughts:

Orpnhfr bs gur cerfrapr bs rzcgl obkrf, ng yrnfg bar bs gur sbhe cynaf "Obk bar", "Obk gjb, vs gung'f rzcgl gura obk svir", "Obk guerr, vs gung'f rzcgl gura obk svir" naq "Obk sbhe, vs gung'f rzcgl gura obk svir" vf thnenagrrq gb jbex. Fb gurer ner bayl sbhe cbffvovyvgvrf gung arrq gb or qvfgvathvfurq. V qba'g xabj vs vg'f npghnyyl cbffvoyr gb qvfgvathvfu gurz gubhtu.

Date: 2017-06-14 06:17 pm (UTC)
simont: (Default)
From: [personal profile] simont
I think it is impossible in one cast, but I didn't find a trivial method.

Bar vf vapyvarq gb znxr gur fvzcyr vasbezngvba-gurbergvp nethzrag: lbh'er gelvat gb qvfgvathvfu svir cbffvovyvgvrf, ohg n fvatyr fcryypnfg tvirf lbh bayl sbhe nafjref, gung'f abg rabhtu, qbar. Ohg gung vfa'g fhssvpvrag, orpnhfr vg nffhzrf lbh'er gelvat gb qvfgvathvfu gur svir cbffvoyr gernfher-ybpngvbaf, jurernf va snpg vg jbhyq or fhssvpvrag gb qvfgvathvfu sbhe _pbhefrf bs npgvba_ gung orgjrra gurz zhfg vapyhqr n jvaare. Naq gurer ner cresrpgyl tbbq pbyyrpgvbaf bs sbhe pbhefrf bs npgvba – fnl, sbhe gbgny beqref bs gur ontf, rnpu jvgu gur frznagvpf 'bcra gurz bar ol bar va guvf beqre naq fgbc jura bar vf aba-rzcgl' – bs juvpu bar zhfg rapbhagre gur gernfher orsber nal yvpu. Sbe rknzcyr, gur sbhe beqref rnpu yvfg n qvssrerag ont svefg naq gura nyy yvfg gur svsgu ont frpbaq; gura rvgure ont svir vf gernfher, va juvpu pnfr gjb beqref jvyy cvpx na rzcgl ont orsber vg naq jva, be bar bs gur bguref vf gernfher va juvpu pnfr fbzr beqre jvyy cvpx vg svefg naq jva.

Fb vs vg'f abg vzcbffvoyr va bar pnfg ol cher vasbezngvba gurbel, jr unir gb hfr fbzr zber fhogyr ernfbavat nobhg gur cnegvphyne sbezf bs dhrel jr'er nyybjrq. Naq V guvax gur xrl cbvag vf gung vs lbh'er trggvat sbhe cbffvoyr nafjref gb gur dhrel, bar bs gurz unf gb or gur 'obevat' nafjre, naq vs gung'f cbffvoyr, gura vg zhfg or orpnhfr gur cebprqher lbh'er nfxvat nobhg vf pncnoyr bs grezvangvat nsgre bcravat bayl rzcgl ontf. Va juvpu pnfr, gurer vf fbzr frg bs hc gb gjb ontf fhpu gung vs gurl ner rzcgl gura gur dhrel cebprqher jbhyq grezvangr univat abg bcrarq nal bs gur bguref – ohg gur _erfcbafr_ cebprqher zhfg pbzzvg gb bcravat gur erznvavat 3 ontf va _fbzr_ beqre, fb vs gur svefg bar bs gubfr vf n yvpu gura qbbz.

Gung, bs pbhefr, nffhzrf gung lbhe fvatyr dhrel _pna_ erghea gur nafjre 'abguvat'. Vs lbh nfx n dhrfgvba gung pna'g (r.t. bar gung cebzvfrf gb bcra n guveq ont vs gur svefg gjb ner rzcgl), gura lbh qbqtr _gung_ ceboyrz. Ohg abj lbh'er qbja gb bayl guerr pbhefrf bs npgvba, naq jvgu gung srj, vg _vf_ cbffvoyr gb cvpx n cynprzrag bs yvpurf naq gernfher gung jvyy qrsrng nal guerr ont-beqrevatf ab znggre ubj lbh genafyngr fbzr dhrel-erfcbafr vagb bar bs gurz.

Cebbs ol pnfr nanylfvf: vs gur guerr beqref qba'g unir qvfgvapg vavgvny ryrzragf gura V pna whfg yvpu gur svefg ont bs nyy bs gurz, qbar. Vs gurl qb unir qvfgvapg svefg ontf, naq bar bs gurz yvfgf bar bs gubfr fnzr guerr ontf frpbaq (jybt, gurl fgneg NO naq O naq P), gura V pna znxr N rzcgl naq yvpu O naq P, qbar. Fb gur erznvavat cbffvovyvgl vf gung ab beqre'f frpbaq ont vf gur fnzr nf nal beqre'f svefg ont, va juvpu pnfr (ntnva jybt) gurl fgneg NQ, OQ, naq rvgure PQ be PR. Va nyy pnfrf, R vf eryvnoyl cerprqrq ol P be Q be obgu, fb vs V chg gur gernfher va R naq yvpurf va P,Q gura qbar.

Date: 2017-06-15 08:56 am (UTC)
From: [identity profile] khoth.livejournal.com
Naq V guvax gur xrl cbvag vf gung vs lbh'er trggvat sbhe cbffvoyr nafjref gb gur dhrel, bar bs gurz unf gb or gur 'obevat' nafjre, naq vs gung'f cbffvoyr, gura vg zhfg or orpnhfr gur cebprqher lbh'er nfxvat nobhg vf pncnoyr bs grezvangvat nsgre bcravat bayl rzcgl ontf.

V vzntvar lbh pna svk hc lbhe nethzrag, ohg guvf cneg vfa'g dhvgr gehr. Lbh pbhyq unir n cyna jurer vs lbh bcra n ont pbagnvavat gernfher va fbzr pvephzfgnapr be bgure, gura lbh whfg jnyx njnl jvgubhg gnxvat vg.

Date: 2017-06-15 11:38 am (UTC)
simont: (Default)
From: [personal profile] simont
V'z vapyvarq gb guvax gung vs V jrer gur benpyr nafjrevat gurfr dhrevrf, V jbhyq fgvyy pbafvqre gung nf n tbbq bhgpbzr. Gur vzcbegnag cbvag sbe 'tbbq' vf abg gung lbh jnyx njnl jvgu gur gernfher npghnyyl va lbhe unaqf, vg'f gung lbh unir gur _novyvgl_ gb npprff gur gernfher fubhyq lbh jnag vg – naq vs lbh pubbfr abg gb gnxr nqinagntr bs gung novyvgl, gung qbrfa'g artngr gur snpg gung lbh unir vg.

Date: 2017-06-15 02:40 pm (UTC)
From: [identity profile] khoth.livejournal.com
I was assuming I could do it as basically the opposite of the "if this bag contains nothing, I stab myself in the leg" clarification in the original problem statement.

Date: 2017-06-15 02:41 pm (UTC)
From: [identity profile] khoth.livejournal.com
By "opposite" I don't actually mean opposite, but DW doesn't let me edit the comment.

Date: 2017-06-15 12:04 pm (UTC)
ptc24: (Default)
From: [personal profile] ptc24
I just have to say, I'm loving the combination of rot13 and puzzles involving liches - it's really makes it atmospheric.

Date: 2017-06-14 04:07 pm (UTC)
aldabra: (Default)
From: [personal profile] aldabra
So, I line my five bags up in an order, and I have a small knife.

Cast 1: Each time I'm about to open a bag I stab myself in the leg first. I open the bags in this order. How many stab-wounds in my leg when I get eaten? (This identifies the bag containing lich 1. Discard this bag into a convenient nearby volcano.)

Cast 2: As cast 1: identifies other lich. Discard it.

Then open remaining bags at leisure. It's not allowed to tell me how often I've stabbed myself in the leg, is it? But it has four settings, and a lich is always going to be in one of the first four bags. Am I allowed to redefine the outputs? Lich in first bag: nothing. Lich in second bad: bad. Lich in third bag: average. Lich in fourth bag: good. I get the, uh, bard to hypnotise me to set these preferences.

Date: 2017-06-14 04:41 pm (UTC)
aldabra: (Default)
From: [personal profile] aldabra
Do lichen eat each other?

Date: 2017-06-14 06:30 pm (UTC)
simont: (Default)
From: [personal profile] simont
Off-topic, this post has caused me to realise two things.

One, it's a shame that the general movement away from LJ also moves us away from the handy 'spoiler tag in comment' feature, which is about the only actually useful thing that the LJ site software had over DW.

Two, never use HTML tags in a piece of text you plan to make your editor rot13 at the last minute :-)

Date: 2017-06-15 06:06 am (UTC)
simont: (Default)
From: [personal profile] simont
In fairness, I then also realised that if I did successfully rot13 text containing HTML <em> tags and the like, it would be of limited use to a reader, because how would they get it back to legibility except by pasting it out of the browser into a rot13 of their own? And once you do that, you lose the HTML emphasis tags anyway because they don't come with the pasted data, and would have to cross-reference your untangled text to the incomprehensible nonsense in the browser window to remind yourself of which words were supposed to be emphasised. (Or else you paste in HTML mode, so the tags do come with it, but now you not only have to solve the same problem of 'rot13 except for the tags', but you then have to paste the resulting unscrambled text back into an HTML renderer to read it as intended!) So for that reason as well it seemed more sensible to use _this_ kind of emphasis in the rot13ed sections of my comments here, because that will automatically come with the text when it's pasted out into a (de-)rot13er.

I always used to wonder about building a rot13 viewing mode into PuTTY, in which the mouse pointer would become the centre of a little window that you could drift over the text and everything inside that window would appear rot13ed. (I thought of it as 'Smirnoff mode', after the adverts at the time in which things' true nature would be revealed if you held up a Smirnoff bottle and looked at them through it.) The same thing in a browser would have permitted me to write rot13ed text with HTML formatting and give users a sensible way to view it – but that's one of those underambitious fantasies, because if you're prepared to imagine a built-in mechanism for spoiler-management in browsers, you might as well go the whole hog and have it be a special-purpose HTML tag which renders the text in non-revealed mode properly illegible rather than merely a bit confusing. (After all, I hear it is possible to learn to read still-scrambled rot13 – and, worse still, to pick up a few words of it by accident.)

Date: 2017-06-15 10:28 pm (UTC)
From: [identity profile] alextfish.livejournal.com
The prospect of writing that auto-detection code would vex me...