{"id":1158,"date":"2009-01-24T19:49:22","date_gmt":"2009-01-25T00:49:22","guid":{"rendered":"http:\/\/spookyblue.com\/spookyblog\/?p=1158"},"modified":"2009-01-26T15:39:38","modified_gmt":"2009-01-26T20:39:38","slug":"pseudo-code-of-an-orange-cat","status":"publish","type":"post","link":"http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat","title":{"rendered":"Pseudo-code of An Orange Cat"},"content":{"rendered":"<p><span style=\"color: #CDF98D\">\/\/CAT V0.1<br \/>\n<code>while($human-is-present){<br \/>\n&nbsp;&nbsp;if(scan-for-tasty-bugs()==\"none in reach\"){<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;perform-cat-show();<br \/>\n&nbsp;&nbsp;}<br \/>\n}else{<br \/>\n&nbsp;&nbsp;eat-bug();<br \/>\n}<\/code><\/span><\/p>\n<p><b>== Update: 01\/26\/2009 ==<\/b><br \/>\nA conscientious programmer friend, who, surprisingly, wouldn&#8217;t know a historical Star Trek reference if it flew into the room and smacked him in the forehead, has helpfully notified me that the above code contains an error.  The <b>else<\/b> tag cannot be applied to a <b>while()<\/b> loop.<\/p>\n<p>This may explain the constant errors, spontaneous reboots, and otherwise erratic behavior displayed by the V0.1 orange cat.  I have corrected the code, which turned out to be a slight mixup with some curly-braces.  Perfect example of, &#8220;It compiled, so it should work.&#8221;<br \/>\n(Thanks, Daiv.  And Piccard was clearly the better Captain.)<\/p>\n<p><span style=\"color: #CDF98D\">\/\/CAT V0.2<br \/>\n<code>while($human-is-present){<br \/>\n&nbsp;&nbsp;if(scan-for-tasty-bugs()==\"none in reach\"){<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;perform-cat-show();<br \/>\n&nbsp;&nbsp;}else{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;eat-bug();<br \/>\n&nbsp;&nbsp;}<br \/>\n}<\/code><\/span>\n\t\t<style type=\"text\/css\">\n\t\t\t#gallery-1 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 33%;\n\t\t\t}\n\t\t\t#gallery-1 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-1' class='gallery galleryid-1158 gallery-columns-3 gallery-size-thumbnail'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat\/cat01'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/spookyblue.com\/spookyblog\/spblogpix\/2009\/01\/cat01-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat\/cat02'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/spookyblue.com\/spookyblog\/spblogpix\/2009\/01\/cat02-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat\/cat02b'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/spookyblue.com\/spookyblog\/spblogpix\/2009\/01\/cat02b-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat\/cat03'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/spookyblue.com\/spookyblog\/spblogpix\/2009\/01\/cat03-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat\/cat04'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/spookyblue.com\/spookyblog\/spblogpix\/2009\/01\/cat04-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat\/cat04b'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/spookyblue.com\/spookyblog\/spblogpix\/2009\/01\/cat04b-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat\/cat05'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/spookyblue.com\/spookyblog\/spblogpix\/2009\/01\/cat05-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat\/cat06'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/spookyblue.com\/spookyblog\/spblogpix\/2009\/01\/cat06-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/spookyblue.com\/spookyblog\/pseudo-code-of-an-orange-cat\/cat07'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/spookyblue.com\/spookyblog\/spblogpix\/2009\/01\/cat07-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/>\n\t\t<\/div>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/CAT V0.1 while($human-is-present){ &nbsp;&nbsp;if(scan-for-tasty-bugs()==&#8221;none in reach&#8221;){ &nbsp;&nbsp;&nbsp;&nbsp;perform-cat-show(); &nbsp;&nbsp;} }else{ &nbsp;&nbsp;eat-bug(); } == Update: 01\/26\/2009 == A conscientious programmer friend, who, surprisingly, wouldn&#8217;t know a historical Star Trek reference if it flew into the room and smacked him in the forehead, has helpfully notified me that the above code contains an error. The else tag cannot [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[98],"_links":{"self":[{"href":"http:\/\/spookyblue.com\/spookyblog\/wp-json\/wp\/v2\/posts\/1158"}],"collection":[{"href":"http:\/\/spookyblue.com\/spookyblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/spookyblue.com\/spookyblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/spookyblue.com\/spookyblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/spookyblue.com\/spookyblog\/wp-json\/wp\/v2\/comments?post=1158"}],"version-history":[{"count":0,"href":"http:\/\/spookyblue.com\/spookyblog\/wp-json\/wp\/v2\/posts\/1158\/revisions"}],"wp:attachment":[{"href":"http:\/\/spookyblue.com\/spookyblog\/wp-json\/wp\/v2\/media?parent=1158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/spookyblue.com\/spookyblog\/wp-json\/wp\/v2\/categories?post=1158"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/spookyblue.com\/spookyblog\/wp-json\/wp\/v2\/tags?post=1158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}