]/[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]...

","cools":[{"title":"Pseudo_Intellectual","type":"user","node_id":4586},{"title":"Senso","type":"user","node_id":737325}],"createtime":"2003-07-21T21:02:14Z","publishtime":"2003-07-21T21:02:14Z","node_id":1478484,"author":{"node_id":1477422,"type":"user","hidelastseen":0,"title":"drdave","lasttime":"2024-10-24T07:10:44Z","is_bot":0},"title":"How To Catch a Lion in the Sahara Desert (idea)","type":"writeup"}],"createtime":"2003-07-21T20:52:24Z","title":"How To Catch a Lion in the Sahara Desert","type":"e2node"},"user":{"is_editor":0,"info_authorsince_off":0,"node_id":"779713","is_guest":1,"votesafety":0,"can_cool":0,"coolsleft":0,"title":"Guest User","coolsafety":0,"can_vote":0}},"assets_location":"https://s3-us-west-2.amazonaws.com/deployed.everything2.com/7fea468468c9e694b51ba1c454cddfde8737139c","newWriteups":[{"writeuptype":"thing","parent":{"node_id":2213144,"type":"e2node","title":"root log: January update - Live Search is Live!"},"node_id":"2213173","author":{"title":"Sylvar","type":"user","node_id":5988},"is_log":true,"title":"root log: January update - Live Search is Live! (thing)","is_junk":false,"notnew":false},{"writeuptype":"thing","node_id":"2213168","author":{"node_id":1902455,"title":"Pandeism Fish","type":"user"},"is_log":false,"parent":{"node_id":944588,"title":"Row, row, row your boat","type":"e2node"},"is_junk":false,"title":"Row, row, row your boat (thing)","notnew":false},{"writeuptype":"log","title":"January 15, 2026 (log)","is_junk":false,"notnew":false,"parent":{"node_id":2213170,"type":"e2node","title":"January 15, 2026"},"node_id":"2213165","is_log":true,"author":{"title":"Oolong","type":"user","node_id":1017738}},{"writeuptype":"idea","parent":{"title":"Emotive Conjugation","type":"e2node","node_id":2212393},"author":{"type":"user","title":"teleny","node_id":3473},"is_log":false,"node_id":"2213039","notnew":false,"title":"Emotive Conjugation (idea)","is_junk":false},{"writeuptype":"thing","notnew":false,"title":"Black Coffee (thing)","is_junk":false,"parent":{"type":"e2node","title":"Black Coffee","node_id":98029},"author":{"type":"user","title":"wertperch","node_id":958245},"is_log":false,"node_id":"2213158"},{"writeuptype":"opinion","parent":{"type":"e2node","title":"the blurry boundary between immersion and obsession","node_id":2213161},"author":{"title":"passalidae","type":"user","node_id":2178478},"is_log":false,"node_id":"2213160","notnew":false,"is_junk":false,"title":"the blurry boundary between immersion and obsession (opinion)"},{"notnew":false,"title":"root log: January 2026 - Mobile is live, themes resurrected (thing)","is_junk":false,"parent":{"type":"e2node","title":"root log: January 2026 - Mobile is live, themes resurrected","node_id":2213156},"author":{"node_id":459692,"title":"jaybonci","type":"user"},"is_log":true,"node_id":"2213155","writeuptype":"thing"},{"parent":{"type":"e2node","title":"A Woman's Story","node_id":2213152},"author":{"type":"user","title":"Glowing Fish","node_id":977360},"is_log":false,"node_id":"2213153","notnew":false,"is_junk":false,"title":"A Woman's Story (review)","writeuptype":"review"},{"writeuptype":"personal","author":{"type":"user","title":"Auspice","node_id":1866071},"is_log":false,"node_id":"2213147","parent":{"node_id":2184246,"title":"Time cares for us not, though it carries us the path entire.","type":"e2node"},"notnew":false,"title":"Time cares for us not, though it carries us the path entire. (personal)","is_junk":false},{"is_junk":false,"title":"root log: January update - Live Search is Live! (log)","notnew":false,"parent":{"node_id":2213144,"type":"e2node","title":"root log: January update - Live Search is Live!"},"node_id":"2213141","is_log":true,"author":{"node_id":459692,"type":"user","title":"jaybonci"},"writeuptype":"log"},{"writeuptype":"person","title":"Skurge the Executioner (person)","is_junk":false,"notnew":false,"parent":{"type":"e2node","title":"Skurge the Executioner","node_id":2213142},"node_id":"2213143","author":{"type":"user","title":"Jet-Poop","node_id":6339},"is_log":false},{"writeuptype":"poetry","parent":{"node_id":1905443,"type":"e2node","title":"notes written by hand"},"node_id":"2213139","is_log":false,"author":{"title":"Auspice","type":"user","node_id":1866071},"title":"notes written by hand (poetry)","is_junk":false,"notnew":false},{"is_junk":false,"title":"In Chancery (review)","notnew":false,"node_id":"2213138","author":{"node_id":977360,"type":"user","title":"Glowing Fish"},"is_log":false,"parent":{"node_id":2213137,"title":"In Chancery","type":"e2node"},"writeuptype":"review"},{"writeuptype":"poetry","notnew":false,"title":"Sor Juana (poetry)","is_junk":false,"parent":{"type":"e2node","title":"Sor Juana","node_id":2213122},"is_log":false,"author":{"node_id":1681230,"type":"user","title":"BookReader"},"node_id":"2213124"},{"writeuptype":"how-to","is_junk":false,"title":"How to safely ship a trading card (how-to)","notnew":false,"node_id":"2213129","author":{"node_id":2178478,"title":"passalidae","type":"user"},"is_log":false,"parent":{"type":"e2node","title":"How to safely ship a trading card","node_id":2213130}},{"notnew":false,"is_junk":false,"title":"No, I don't miss you (poetry)","parent":{"type":"e2node","title":"No, I don't miss you","node_id":2213119},"author":{"type":"user","title":"lilah june","node_id":2201248},"is_log":false,"node_id":"2213006","writeuptype":"poetry"},{"is_junk":false,"title":"Tales of Paranoia (review)","notnew":false,"node_id":"2213114","author":{"type":"user","title":"JD","node_id":1455010},"is_log":false,"parent":{"node_id":2213117,"title":"Tales of Paranoia","type":"e2node"},"writeuptype":"review"},{"title":"January 6, 2026 (log)","is_junk":false,"notnew":false,"node_id":"2213116","author":{"node_id":2197862,"type":"user","title":"avebiewa"},"is_log":true,"parent":{"type":"e2node","title":"January 6, 2026","node_id":2213113},"writeuptype":"log"},{"writeuptype":"thing","notnew":false,"is_junk":false,"title":"root log: January 2026 (thing)","is_log":true,"author":{"node_id":459692,"type":"user","title":"jaybonci"},"node_id":"2213103","parent":{"node_id":2213093,"title":"root log: January 2026","type":"e2node"}},{"node_id":"2213104","author":{"type":"user","title":"Peaceful Chicken","node_id":2208334},"is_log":false,"parent":{"title":"Venezuela","type":"e2node","node_id":30088},"title":"Venezuela (dream)","is_junk":false,"notnew":false,"writeuptype":"dream"},{"notnew":false,"is_junk":false,"title":"root log: December 2025 (thing)","is_log":true,"author":{"title":"Milen","type":"user","node_id":838342},"node_id":"2213100","parent":{"node_id":2212850,"type":"e2node","title":"root log: December 2025"},"writeuptype":"thing"},{"writeuptype":"log","notnew":false,"is_junk":false,"title":"January 1, 2026 (log)","is_log":true,"author":{"node_id":2178478,"title":"passalidae","type":"user"},"node_id":"2213095","parent":{"title":"January 1, 2026","type":"e2node","node_id":2213091}},{"writeuptype":"review","is_junk":false,"title":"A Fire Upon the Deep (review)","notnew":false,"parent":{"type":"e2node","title":"A Fire Upon the Deep","node_id":515968},"node_id":"2213094","author":{"node_id":977360,"title":"Glowing Fish","type":"user"},"is_log":false},{"writeuptype":"fiction","notnew":false,"title":"And it's one more good thing that will never be again (fiction)","is_junk":false,"parent":{"node_id":748951,"title":"And it's one more good thing that will never be again","type":"e2node"},"author":{"type":"user","title":"gate","node_id":1252419},"is_log":false,"node_id":"2213090"},{"writeuptype":"opinion","node_id":"2213088","author":{"type":"user","title":"Pseudo_Intellectual","node_id":4586},"is_log":false,"parent":{"node_id":2213087,"type":"e2node","title":"Was Inspector Dangerfuck the first webcomic?"},"title":"Was Inspector Dangerfuck the first webcomic? (opinion)","is_junk":false,"notnew":false},{"parent":{"node_id":2213084,"title":"The Pottersville Christmas Interloper","type":"e2node"},"node_id":"2213083","is_log":false,"author":{"node_id":1489024,"type":"user","title":"artman2003"},"is_junk":false,"title":"The Pottersville Christmas Interloper (fiction)","notnew":false,"writeuptype":"fiction"},{"writeuptype":"thing","node_id":"2213077","author":{"title":"Pandeism Fish","type":"user","node_id":1902455},"is_log":false,"parent":{"node_id":2213078,"title":"Hell, but for chickens","type":"e2node"},"title":"Hell, but for chickens (thing)","is_junk":false,"notnew":false},{"is_log":false,"author":{"node_id":2178478,"title":"passalidae","type":"user"},"node_id":"2213072","parent":{"node_id":2213073,"title":"tips for making stronger coffee","type":"e2node"},"notnew":false,"is_junk":false,"title":"tips for making stronger coffee (how-to)","writeuptype":"how-to"},{"writeuptype":"thing","title":"Yogi Berra","is_junk":false,"notnew":false,"node_id":"2213063","is_log":false,"author":{"type":"user","title":"teleny","node_id":3473},"parent":{"node_id":157373,"type":"e2node","title":"Yogi Berra"}},{"writeuptype":"review","notnew":false,"is_junk":false,"title":"Spider-Man Storm and Power Man Battle Smokescreen","is_log":false,"author":{"node_id":977360,"type":"user","title":"Glowing Fish"},"node_id":"2213062","parent":{"type":"e2node","title":"Spider-Man Storm and Power Man Battle Smokescreen","node_id":2213061}},{"node_id":"2213025","author":{"node_id":958245,"title":"wertperch","type":"user"},"is_log":true,"parent":{"node_id":2213049,"type":"e2node","title":"December 23, 2025"},"is_junk":false,"title":"December 19, 2025","notnew":false,"writeuptype":"personal"},{"writeuptype":"review","notnew":false,"is_junk":false,"title":"Flare Star","author":{"node_id":977360,"title":"Glowing Fish","type":"user"},"is_log":false,"node_id":"2213042","parent":{"node_id":2213041,"title":"Flare Star","type":"e2node"}},{"notnew":false,"is_junk":false,"title":"Following the path of least resistance is what makes the river crooked.","parent":{"type":"e2node","title":"Following the path of least resistance is what makes the river crooked.","node_id":1821363},"is_log":false,"author":{"node_id":1931459,"type":"user","title":"haqiqat"},"node_id":"2202509","writeuptype":"personal"},{"writeuptype":"person","parent":{"type":"e2node","title":"Chris Rea","node_id":572578},"is_log":false,"author":{"type":"user","title":"Jet-Poop","node_id":6339},"node_id":"572581","notnew":false,"is_junk":false,"title":"Chris Rea"},{"title":"root log: mid-December 2025: Writeup display overhaul (thing)","is_junk":false,"notnew":false,"node_id":"2213036","is_log":true,"author":{"title":"jaybonci","type":"user","node_id":459692},"parent":{"node_id":2213040,"title":"root log: mid-December 2025: Writeup display overhaul","type":"e2node"},"writeuptype":"thing"},{"is_junk":false,"title":"Affluxion (idea)","notnew":false,"parent":{"title":"Affluxion","type":"e2node","node_id":181089},"node_id":"2213021","author":{"type":"user","title":"avebiewa","node_id":2197862},"is_log":false,"writeuptype":"idea"},{"author":{"type":"user","title":"wertperch","node_id":958245},"is_log":false,"node_id":"2213015","parent":{"title":"Avalon","type":"e2node","node_id":21764},"notnew":false,"is_junk":false,"title":"Avalon (place)","writeuptype":"place"},{"parent":{"node_id":15679,"title":"water","type":"e2node"},"is_log":false,"author":{"type":"user","title":"losthuskie","node_id":2178234},"node_id":"2213014","notnew":false,"is_junk":false,"title":"water (poetry)","writeuptype":"poetry"},{"writeuptype":"review","author":{"title":"Glowing Fish","type":"user","node_id":977360},"is_log":false,"node_id":"2213009","parent":{"node_id":21764,"type":"e2node","title":"Avalon"},"notnew":false,"is_junk":false,"title":"Avalon (review)"}],"nodetype":"e2node"}