|We don't bite newbies here... much|
MidLifeXis's scratchpadby MidLifeXis (Monsignor)
|on Jun 01, 2004 at 18:01 UTC||Need Help??|
(2014/12/18) - for thezip
(2014/01/15) - for Lady_Aleena
or break up the ARRAY check
or just use if/else
(2013/12/06) - for SwaJime
(2013/10/23) - MLX is the answer to everything
perl -le '$s+=ord($_)>>1 for split//,MLX;print +(scalar reverse $s)<<1' (thanks to shmem)
(2013/10/22) - Limbic~Region's logic puzzle
Filed away for later mulling.
Limbic~Region Logic Puzzle: There are 3 boxes (2 empty, 1 containing a 1 million dollar diamond). You have a truth machine that can answer any yes/no question with 100% accuracy. You may ask 2 questions. The machine will flash red or green Limbic~Region problem is - you don't know if yes = red or green. What 2 questions do you ask to get the diamond? MidLifeXis Hmm, sounds like a variant on the one with a truth teller + liar that guard two doors, one to untold riches and one to certain doom. moritz there must be at least one question with both gives you information about whether red is yes, and some information on the boxes Limbic~Region moritz - boolean logic is allowed so yes Limbic~Region There are 4 possible outcomes and 3 boxes: green, green; green, red; red, green; red, red moritz there are 8 possible questions one can ask MidLifeXis MidLifeXis files that away for later. Is there a name for this puzzle? moritz since asking the same question twice is pretty senseless, you can brute-force your way through 8 * 7 == 56 possible combinations moritz divided by 2, because of commutation Limbic~Region MidLifeXis - not that I know of. I haven't found it online anywhere. The closest I have come is The_Hardest_Logic_Puzzle_Ever Limbic~Region Limbic~Region patiently waits for moritz to come up with a suitable answer from his brute forcing MidLifeXis Can you also include the meaning of the red/green indicator in your question? MidLifeXis If so, I think that you can reduce it to my related problem (I think - not enough coffee yet) MidLifeXis or are you only allowed to ask about the box state? moritz no, there are more possible questions to ask. I was wrong. hdb can you ask your second question depending on the outcome of the first? Limbic~Region MidLifeXis: Your question has to be yes/no so you could ask "does green mean yes" but if it answers green you still don't know. I do not see how to reduce the problem to the one you described Limbic~Region hdb - absolutely MidLifeXis second para under history in LR's link (Knights and Knaves) is the one I was referring to. Limbic~Region There is a class of problems called knights/knaves. One of the variations is where they respond in an unknown language for yes/no - which is also very similar but not exactly like this - also available on wikipedia MidLifeXis With boolean logic, I think you could add in ((yes == green) ^ (diamond in boxa)), but not sure on that yet. Have to mull over it a bit. Limbic~Region Knights_and_knaves MidLifeXis however, since it has been discounted so rapidly by LR, I am guessing that I am going down the wrong path ;-) MidLifeXis (or not - see solution section in The_Hardest_Logic_Puzzle_Ever Limbic~Region MidLifeXis: No. I was discounting the "which path leads to untold riches" puzzle you originally mentioned MidLifeXis Ahh, ok. MidLifeXis It seems like you need to embed, as part of your question, an assertion that eliminates the unknown part of the red/green (something like duct tape) ;-) MidLifeXis and on that note, /me files this diversion away for later. Limbic~Region It is perfectly fine to do something like ask - is my name Limbic~Region to determine if green means yes or no. The problem is that you need to obtain that information while also obtaining information about the boxes or else you don't have enough Qs
(2013/09/09) - IP stuff in perl
(2011/12/02) - Test::More
with use_ok not in a BEGIN block...
With use_ok in a BEGIN block...
(2011/05/05) - Operators
(2011/01/23) - differences between table and div thread layouts
Work in progress
Structure for table-based layout
Structure for div-based layout
(2010/06/24) - code that displays differently based on tabstops
(2010/02/03) - Trying to trap a die inside of a use
and $module contains....
(2010/01/15) - for MikeDexter: Rework II
(2010/01/08) - for MikeDexter: Rework
(2009/10/23) - for gmtheodore: simple helloworld.cgi
(2009/07/22) - For samwyse: capturing matches in array
(2009/06/19) - Truth under Win32::OLE
(2009/02/18) - Shouldn't these be the same?
Shouldn't these be the same? The first is giving a coredump, and the second works correctly.
Fails with a coredump
It looks to me like the undef assignment is calling the DESTROY method on $blah, but just the assignment is not. Since it generates a coredump, I am reporting it as a bug anyway, but just for my knowledge, shouldn't the DESTROY method also be called on the first example?
(2007/Mar/21) - How to diff the file structures of two directories
(2007/Feb/06) - How to make a program execute only once and only if a file matching a pattern exists, oh, and continue after checking the first if...
(2007/Feb/06) - How to make a program execute only once and only if a file matching a pattern exists
(2005/08/16) - differences between shell quoting
Under your favorite sh derived shell, quotes make a big difference... See the following table
Trying to store all unique matches for a pattern....