]/[Prolog], this problem would be [trivial] to solve.\r\n\r\n

4.6 The [standard approach].

\r\n\r\n

We know what a Lion is from [ISO] 4711/X.123. Since [CCITT] have specified a Lion to be a [particular option] of a [cat] we will have to wait for a [harmonized standard] to appear. $20,000,000 have been [fund]ed for [initial investigations] into this [standard development].\r\n\r\n

[linear search|4.7 Linear search.]

\r\n\r\n

Stand in the top left hand [corner] of the Sahara Desert. Take one [step] east. Repeat until you have found the lion, or you reach the right hand edge. If you reach the right hand [edge], take one step southwards, and proceed towards the left hand edge. When you finally reach the lion, put it the cage. If the lion should happen to eat you before you manage to get it in the cage, press the [reset button], and try again.\r\n

Optionally, [experienced programmer]s will place a [pink elephant] in [Johannesburg] as a [sentinel value]. (thanks [ariels])\r\n \r\n

[Dijkstra's algorithm |4.8 The Dijkstra approach:]

\r\n\r\n

The way the problem reached me was: catch a wild lion in the Sahara\r\nDesert. [Another way of stating the problem] is:\r\n\r\n

\r\n       [Axiom] 1: Sahara [elem] deserts\r\n       Axiom 2: Lion elem Sahara\r\n       Axiom 3: NOT(Lion elem cage)\r\n
\r\n

We observe the following invariant:\r\n\r\n

       P1:     C(L) v not(C(L))\r\n
\r\n

where C(L) means: the value of \"L\" is in the cage.\r\n\r\n

Establishing C initially is trivially accomplished with the statement\r\n\r\n

       ;cage := {}\r\nNote 0:\r\n[This is easily implemented] by opening the door to the \r\ncage and shaking out any lions that happen to be there \r\ninitially.\r\n(End of note 0.)\r\n
\r\n

The obvious [program structure] is then:\r\n

\r\n       ;cage:={}\r\n       ;do NOT (C(L)) ->\r\n               ;\"approach lion under [invariance] of P1\"\r\n               ;if P(L) ->\r\n                       ;\"insert lion in cage\"\r\n                [] not P(L) ->\r\n                       ;skip\r\n               ;fi\r\n       ;od\r\n\r\nwhere P(L) means: the value of L is within arm's reach.\r\n\r\nNote 1:\r\nAxiom 2 ensures that the [loop termination|loop terminates].\r\n(End of note 1.)\r\n\r\nExercise 0:\r\nRefine the step \"Approach lion under invariance of P1\".\r\n(End of exercise 0.)\r\n\r\nNote 2:\r\nThe program is [robust] in the sense that it will lead to\r\n[abortion] if the value of L is \"lioness\".\r\n(End of note 2.)\r\n\r\nRemark 0: This may be a new sense of the word \"robust\" for you.\r\n(End of remark 0.)\r\n\r\nNote 3:\r\n\r\nFrom observation we can see that the above program leads to the\r\n[desired goal]. It goes without saying that we therefore do not \r\nhave to [run] it.\r\n(End of note 3.)\r\n(End of approach.) \r\n(End of document)\r\n
\r\n\r\n         
\r\n\r\n

You can find an infinity of variations on the above [theme] floating around in the [cyberspace] (and probably in [dead tree] format too), but some of them tend to wear the concept a bit [thin]...

","author":{"lasttime":"2024-10-24T07:10:44Z","title":"drdave","is_bot":0,"node_id":1477422,"type":"user","hidelastseen":0}}],"node_id":1478480,"title":"How To Catch a Lion in the Sahara Desert","locked":0,"author":{"type":"usergroup","title":"Content Editors","node_id":923653}},"categories":[]},"nodeletorder":["sign_in","recommended_reading","new_writeups"],"assets_location":"https://s3-us-west-2.amazonaws.com/deployed.everything2.com/ff57790348b58c2d84549c750fca2a8354ed26ad","lastnode_id":null,"newWriteups":[{"parent":{"title":"Answer to Robert","node_id":2214417,"type":"e2node"},"is_junk":false,"writeuptype":"personal","title":"Answer to Robert (personal)","author":{"title":"lostcauser","node_id":1992599,"type":"user"},"node_id":"2214416","notnew":false,"is_log":false},{"notnew":false,"is_log":true,"title":"September 9, 2026 (personal)","author":{"type":"user","title":"jessicaj","node_id":1934284},"node_id":"2214405","writeuptype":"personal","is_junk":false,"parent":{"title":"September 9, 2026","node_id":2214401,"type":"e2node"}},{"title":"Theaetetus (review)","author":{"type":"user","node_id":977360,"title":"Glowing Fish"},"node_id":"2214402","notnew":false,"is_log":false,"parent":{"type":"e2node","node_id":1186582,"title":"Theaetetus"},"is_junk":false,"writeuptype":"review"},{"notnew":false,"is_log":false,"node_id":"2214403","title":"and they were so small you could no longer read the titles (poetry)","author":{"node_id":1992599,"title":"lostcauser","type":"user"},"writeuptype":"poetry","is_junk":false,"parent":{"node_id":2214404,"title":"and they were so small you could no longer read the titles","type":"e2node"}},{"is_log":false,"notnew":false,"author":{"node_id":6339,"title":"Jet-Poop","type":"user"},"title":"Searoad (review)","node_id":"2214398","writeuptype":"review","parent":{"type":"e2node","node_id":1299224,"title":"Searoad"},"is_junk":false},{"is_log":false,"notnew":false,"author":{"node_id":1992599,"title":"lostcauser","type":"user"},"title":"The Playing Field (fiction)","node_id":"2214392","writeuptype":"fiction","is_junk":false,"parent":{"title":"The Playing Field","node_id":2214393,"type":"e2node"}},{"author":{"title":"wertperch","node_id":958245,"type":"user"},"title":"Coffea Arabica (thing)","node_id":"2214390","is_log":false,"notnew":false,"parent":{"type":"e2node","node_id":445367,"title":"Coffea Arabica"},"is_junk":false,"writeuptype":"thing"},{"writeuptype":"idea","parent":{"title":"How to read a coffee label","node_id":2214353,"type":"e2node"},"is_junk":false,"notnew":false,"is_log":false,"node_id":"2214354","title":"How to read a coffee label (idea)","author":{"type":"user","title":"wertperch","node_id":958245}},{"is_junk":false,"parent":{"type":"e2node","title":"Buna","node_id":2214376},"writeuptype":"thing","node_id":"2214377","author":{"title":"wertperch","node_id":958245,"type":"user"},"title":"Buna (thing)","is_log":false,"notnew":false},{"node_id":"2214370","author":{"title":"lostcauser","node_id":1992599,"type":"user"},"title":"It's Been Yesterday All Too Long - for Gloria Steinem (personal)","is_log":false,"notnew":false,"parent":{"node_id":2214371,"title":"It's Been Yesterday All Too Long - for Gloria Steinem","type":"e2node"},"is_junk":false,"writeuptype":"personal"},{"title":"Operating Systems: Three Easy Pieces (review)","author":{"title":"shikigami","node_id":2211696,"type":"user"},"node_id":"2214366","notnew":false,"is_log":false,"parent":{"title":"Operating Systems: Three Easy Pieces","node_id":2214368,"type":"e2node"},"is_junk":false,"writeuptype":"review"},{"is_log":false,"notnew":false,"node_id":"2211965","author":{"type":"user","node_id":958245,"title":"wertperch"},"title":"single origin coffee (thing)","writeuptype":"thing","is_junk":false,"parent":{"node_id":2211069,"title":"single origin coffee","type":"e2node"}},{"writeuptype":"thing","parent":{"title":"Torrefacto","node_id":2104847,"type":"e2node"},"is_junk":false,"notnew":false,"is_log":false,"title":"Torrefacto (thing)","author":{"type":"user","title":"wertperch","node_id":958245},"node_id":"2214361"},{"writeuptype":"thing","is_junk":false,"parent":{"title":"Torrefacto","node_id":2104847,"type":"e2node"},"notnew":false,"is_log":false,"node_id":"2214320","title":"Torrefacto (thing)","author":{"title":"shikigami","node_id":2211696,"type":"user"}},{"parent":{"node_id":2212870,"title":"coffee cupping","type":"e2node"},"is_junk":false,"writeuptype":"thing","author":{"type":"user","node_id":958245,"title":"wertperch"},"title":"coffee cupping (thing)","node_id":"2214351","is_log":false,"notnew":false},{"node_id":"2121065","author":{"type":"user","node_id":1931459,"title":"haqiqat"},"title":"the hope of a skinny kid with a funny name who believes that America has a place for him, too (personal)","is_log":false,"notnew":false,"is_junk":false,"parent":{"title":"the hope of a skinny kid with a funny name who believes that America has a place for him, too","node_id":1668758,"type":"e2node"},"writeuptype":"personal"},{"writeuptype":"personal","parent":{"title":"August 30, 2026","node_id":2214343,"type":"e2node"},"is_junk":false,"is_log":true,"notnew":false,"node_id":"2214346","author":{"title":"Kazeryu","node_id":627653,"type":"user"},"title":"August 30, 2026 (personal)"},{"writeuptype":"thing","is_junk":false,"parent":{"type":"e2node","node_id":2214344,"title":"Form 1040 Schedule 1"},"is_log":false,"notnew":false,"author":{"title":"Glowing Fish","node_id":977360,"type":"user"},"title":"Form 1040 Schedule 1 (thing)","node_id":"2214345"},{"author":{"type":"user","title":"panamaus","node_id":983517},"title":"Maxwell's Silver Hammer (review)","node_id":"2214333","is_log":false,"notnew":false,"is_junk":false,"parent":{"type":"e2node","title":"Maxwell's Silver Hammer","node_id":1731352},"writeuptype":"review"},{"writeuptype":"review","parent":{"node_id":2214338,"title":"Bring Back Yesterday","type":"e2node"},"is_junk":false,"is_log":false,"notnew":false,"node_id":"2214339","author":{"type":"user","node_id":977360,"title":"Glowing Fish"},"title":"Bring Back Yesterday (review)"},{"title":"Dragon Architecture (thing)","author":{"title":"Finky","node_id":2212534,"type":"user"},"node_id":"2214331","notnew":false,"is_log":false,"is_junk":false,"parent":{"type":"e2node","node_id":2214332,"title":"Dragon Architecture"},"writeuptype":"thing"},{"notnew":false,"is_log":false,"node_id":"2214328","title":"Fire is the only fuel for eternity (poetry)","author":{"type":"user","title":"rosetinted","node_id":2061110},"writeuptype":"poetry","is_junk":false,"parent":{"type":"e2node","node_id":2214327,"title":"Fire is the only fuel for eternity"}},{"notnew":false,"is_log":false,"node_id":"2214324","title":"Smile Amelia Smile for the Camera (poetry)","author":{"title":"lostcauser","node_id":1992599,"type":"user"},"writeuptype":"poetry","is_junk":false,"parent":{"title":"Smile Amelia Smile for the Camera","node_id":2214325,"type":"e2node"}},{"notnew":false,"is_log":false,"title":"Cedar St. W (thing)","author":{"type":"user","title":"Finky","node_id":2212534},"node_id":"2214318","writeuptype":"thing","parent":{"node_id":2214321,"title":"Cedar St. W","type":"e2node"},"is_junk":false},{"parent":{"type":"e2node","title":"obsessing over coffee","node_id":2214232},"is_junk":false,"writeuptype":"thing","title":"obsessing over coffee (thing)","author":{"node_id":958245,"title":"wertperch","type":"user"},"node_id":"2214238","notnew":false,"is_log":false},{"node_id":"2214312","author":{"node_id":958245,"title":"wertperch","type":"user"},"title":"YANAC (opinion)","is_log":false,"notnew":false,"parent":{"node_id":924445,"title":"YANAC","type":"e2node"},"is_junk":false,"writeuptype":"opinion"},{"parent":{"node_id":1484179,"title":"Terroir","type":"e2node"},"is_junk":false,"writeuptype":"thing","node_id":"2211676","author":{"title":"wertperch","node_id":958245,"type":"user"},"title":"Terroir (thing)","is_log":false,"notnew":false},{"node_id":"2214311","title":"August 26, 2026 (personal)","author":{"title":"wertperch","node_id":958245,"type":"user"},"notnew":false,"is_log":true,"parent":{"title":"August 26, 2026","node_id":2214303,"type":"e2node"},"is_junk":false,"writeuptype":"personal"},{"is_log":true,"notnew":false,"author":{"node_id":1505883,"title":"savpixie","type":"user"},"title":"August 26, 2026 (thing)","node_id":"2214310","writeuptype":"thing","is_junk":false,"parent":{"type":"e2node","title":"August 26, 2026","node_id":2214303}},{"is_junk":false,"parent":{"type":"e2node","title":"Theatrical superstitions","node_id":1064456},"writeuptype":"thing","author":{"title":"wertperch","node_id":958245,"type":"user"},"title":"Theatrical superstitions (thing)","node_id":"2214304","is_log":false,"notnew":false},{"is_log":false,"notnew":false,"author":{"type":"user","title":"Dustyblue","node_id":2068077},"title":"The Northern Caves (thing)","node_id":"2212600","writeuptype":"thing","is_junk":false,"parent":{"title":"The Northern Caves","node_id":2214300,"type":"e2node"}},{"title":"Caffeine tolerance (thing)","author":{"type":"user","title":"wertperch","node_id":958245},"node_id":"2213446","notnew":false,"is_log":false,"is_junk":false,"parent":{"node_id":2213445,"title":"Caffeine tolerance","type":"e2node"},"writeuptype":"thing"},{"writeuptype":"log","parent":{"type":"e2node","title":"August 24, 2026","node_id":2214277},"is_junk":false,"is_log":true,"notnew":false,"author":{"node_id":2178478,"title":"hypostyle","type":"user"},"title":"August 24, 2026 (log)","node_id":"2214293"},{"writeuptype":"thing","is_junk":false,"parent":{"node_id":636560,"title":"Mr. Coffee","type":"e2node"},"is_log":false,"notnew":false,"author":{"node_id":958245,"title":"wertperch","type":"user"},"title":"Mr. Coffee (thing)","node_id":"2214292"},{"node_id":"2214289","author":{"type":"user","title":"wertperch","node_id":958245},"title":"Dorothy Jones (person)","is_log":false,"notnew":false,"parent":{"title":"Dorothy Jones","node_id":2214268,"type":"e2node"},"is_junk":false,"writeuptype":"person"},{"writeuptype":"thing","parent":{"type":"e2node","node_id":1292641,"title":"Ancient Heart"},"is_junk":false,"notnew":false,"is_log":false,"node_id":"2214288","title":"Ancient Heart (thing)","author":{"title":"wertperch","node_id":958245,"type":"user"}},{"writeuptype":"idea","is_junk":false,"parent":{"title":"No cappuccino after midday","node_id":2214284,"type":"e2node"},"notnew":false,"is_log":false,"node_id":"2214285","title":"No cappuccino after midday (idea)","author":{"node_id":958245,"title":"wertperch","type":"user"}},{"parent":{"type":"e2node","title":"Affogato","node_id":1454555},"is_junk":false,"writeuptype":"thing","title":"Affogato (thing)","author":{"type":"user","node_id":958245,"title":"wertperch"},"node_id":"2214283","notnew":false,"is_log":false},{"title":"Phone Anxiety (personal)","author":{"node_id":2014113,"title":"vongrim","type":"user"},"node_id":"2201594","notnew":false,"is_log":false,"is_junk":false,"parent":{"type":"e2node","title":"Phone Anxiety","node_id":2201593},"writeuptype":"personal"}],"developerNodelet":{},"coolnodes":[{"parentTitle":"Answer to Robert","writeupCooled":1,"coolwriteups_id":2214416,"parentNode":2214417,"latest_cool":"2026-09-11 19:15:58","wu_author":"lostcauser"},{"wu_author":"gnarl","parentNode":458994,"coolwriteups_id":2000000,"latest_cool":"2026-09-11 15:23:55","writeupCooled":2,"parentTitle":"Well if it's gonna be THAT kinda party, then I'm gonna stick my dick in the mashed potatoes!"},{"wu_author":"Jurph","latest_cool":"2026-09-11 11:52:25","coolwriteups_id":1125993,"parentNode":1125989,"parentTitle":"Sestina for a Turning Point","writeupCooled":2},{"wu_author":"factgirl","writeupCooled":10,"parentTitle":"Werner Herzog","parentNode":130194,"coolwriteups_id":1436885,"latest_cool":"2026-09-11 06:04:22"},{"parentTitle":"Searoad","writeupCooled":1,"latest_cool":"2026-09-11 06:02:30","coolwriteups_id":2214398,"parentNode":1299224,"wu_author":"Jet-Poop"},{"wu_author":"Grzcyrgba","parentNode":1051916,"coolwriteups_id":1051918,"latest_cool":"2026-09-10 02:01:09","parentTitle":"Annie Jump Cannon","writeupCooled":3},{"wu_author":"moeyz","writeupCooled":2,"parentTitle":"because death is just so full, and man so small","parentNode":2099508,"coolwriteups_id":2152383,"latest_cool":"2026-09-09 23:50:59"},{"latest_cool":"2026-09-09 17:44:33","parentNode":693935,"coolwriteups_id":1672919,"parentTitle":"Carrie","writeupCooled":1,"wu_author":"skybluefusion"},{"parentTitle":"September 9, 2026","wu_author":"jessicaj","writeupCooled":1,"parentNode":2214401,"coolwriteups_id":2214405,"latest_cool":"2026-09-09 15:00:46"},{"writeupCooled":3,"parentTitle":"the hope of a skinny kid with a funny name who believes that America has a place for him, too","latest_cool":"2026-09-09 02:57:22","coolwriteups_id":2121065,"parentNode":1668758,"wu_author":"haqiqat"},{"coolwriteups_id":1621493,"parentNode":121290,"latest_cool":"2026-09-08 15:05:50","writeupCooled":3,"wu_author":"Mardy","parentTitle":"Indian Ocean"},{"coolwriteups_id":2214333,"parentNode":1731352,"latest_cool":"2026-09-08 07:50:47","parentTitle":"Maxwell's Silver Hammer","writeupCooled":5,"wu_author":"panamaus"},{"writeupCooled":6,"wu_author":"Gorgonzola","parentTitle":"Chesapeake Bay","parentNode":788846,"coolwriteups_id":1338995,"latest_cool":"2026-09-07 20:16:20"},{"wu_author":"doy","writeupCooled":2,"parentTitle":"harmonic","latest_cool":"2026-09-07 12:34:46","parentNode":105916,"coolwriteups_id":1485249},{"writeupCooled":1,"wu_author":"lostcauser","parentTitle":"The Playing Field","latest_cool":"2026-09-06 16:00:08","coolwriteups_id":2214392,"parentNode":2214393},{"latest_cool":"2026-09-06 11:05:53","parentNode":2214371,"coolwriteups_id":2214370,"parentTitle":"It's Been Yesterday All Too Long - for Gloria Steinem","writeupCooled":3,"wu_author":"lostcauser"},{"parentTitle":"Lindsay Lohan","writeupCooled":3,"coolwriteups_id":1547258,"parentNode":1482170,"latest_cool":"2026-09-06 05:00:26","wu_author":"18thCandidate"},{"wu_author":"Pandeism Fish","latest_cool":"2026-09-06 02:03:08","parentNode":339177,"coolwriteups_id":2047520,"parentTitle":"Superstition","writeupCooled":3},{"wu_author":"wertperch","latest_cool":"2026-09-05 01:15:41","parentNode":2214353,"coolwriteups_id":2214354,"parentTitle":"How to read a coffee label","writeupCooled":1},{"parentTitle":"Avro Vulcan","writeupCooled":1,"parentNode":1413769,"coolwriteups_id":2028544,"latest_cool":"2026-09-04 19:15:01","wu_author":"The Custodian"},{"parentTitle":"2 PARA","writeupCooled":1,"wu_author":"Omega Hunter","parentNode":1246163,"coolwriteups_id":1246167,"latest_cool":"2026-09-04 19:11:58"},{"writeupCooled":2,"parentTitle":"single origin coffee","latest_cool":"2026-09-03 17:58:33","coolwriteups_id":2211965,"parentNode":2211069,"wu_author":"wertperch"},{"writeupCooled":3,"parentTitle":"The Vast of Night","coolwriteups_id":2183183,"parentNode":2183187,"latest_cool":"2026-09-03 13:56:52","wu_author":"JD"},{"writeupCooled":2,"parentTitle":"Torrefacto","latest_cool":"2026-09-03 01:27:12","coolwriteups_id":2104852,"parentNode":2104847,"wu_author":"Tem42"},{"wu_author":"wertperch","writeupCooled":1,"parentTitle":"Torrefacto","latest_cool":"2026-09-02 14:56:54","parentNode":2104847,"coolwriteups_id":2214361},{"wu_author":"raincomplex","parentNode":1961550,"coolwriteups_id":1961551,"latest_cool":"2026-09-02 13:01:43","parentTitle":"another mind","writeupCooled":2},{"latest_cool":"2026-09-01 22:48:52","coolwriteups_id":2214320,"parentNode":2104847,"writeupCooled":1,"parentTitle":"Torrefacto","wu_author":"shikigami"},{"wu_author":"The Custodian","writeupCooled":4,"parentTitle":"Café Bustelo","latest_cool":"2026-09-01 20:08:30","coolwriteups_id":1973932,"parentNode":1973931},{"latest_cool":"2026-08-31 22:04:07","coolwriteups_id":1342904,"parentNode":1342901,"writeupCooled":1,"parentTitle":"antidiabetic","wu_author":"gwenllian"},{"wu_author":"Stuart","writeupCooled":4,"parentTitle":"Neem Oil","latest_cool":"2026-08-31 21:59:56","parentNode":2037248,"coolwriteups_id":2037252}],"user":{"title":"Guest User","developer":false,"node_id":"779713","guest":true,"in_room":0,"admin":false,"editor":false,"chanop":false},"use_local_assets":"0","chatterbox":{"borged":0,"numborged":1},"staffpicks":[{"title":"'Ayin","node_id":"1869978","type":"e2node"},{"type":"e2node","node_id":"10349","title":"Fear and Loathing in Las Vegas"},{"node_id":"130922","title":"feudalism","type":"e2node"},{"node_id":"642177","title":"Minamoto Yoshitsune","type":"e2node"},{"type":"e2node","title":"25 ways not to tell someone that you're in love with them","node_id":"171498"},{"type":"e2node","title":"ekpyrotic universe","node_id":"1022603"},{"title":"How to assassinate a third world despot with only a butt plug and a litre of raspberry coulis","node_id":"1369285","type":"e2node"},{"node_id":"1435657","title":"The United States is already at war with Iraq","type":"e2node"},{"node_id":"72142","title":"In the Aeroplane Over the Sea","type":"e2node"},{"type":"e2node","node_id":"514221","title":"Lightning Crashes"},{"title":"F-14 Tomcat","node_id":"36228","type":"e2node"},{"type":"e2node","title":"condom","node_id":"22584"},{"type":"e2node","title":"kindergarten","node_id":"80466"},{"type":"e2node","node_id":"842271","title":"sexagesimal numbers"},{"type":"e2node","node_id":"759178","title":"Finding minima and maxima"}],"hasMessagesNodelet":0,"architecture":"aarch64","pageheader":{}}