Pseudo-code of An Orange Cat

//CAT V0.1
while($human-is-present){
  if(scan-for-tasty-bugs()=="none in reach"){
    perform-cat-show();
  }
}else{
  eat-bug();
}

== Update: 01/26/2009 ==
A conscientious programmer friend, who, surprisingly, wouldn’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 be applied to a while() loop.

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, “It compiled, so it should work.”
(Thanks, Daiv. And Piccard was clearly the better Captain.)

//CAT V0.2
while($human-is-present){
  if(scan-for-tasty-bugs()=="none in reach"){
    perform-cat-show();
  }else{
    eat-bug();
  }
}

5 Responses to “Pseudo-code of An Orange Cat”

  1. If humans present food (treats)
    then initiate mooch/follow mode

  2. If do not present food from behind door + attempt to/// with extreme malice. If/failure=fatal error/object type human//Sit and

  3. The above perfectly describes what’s going on inside a cat’s brain when, in the middle of giving itself a bath, it switches to attack ninja and goes berserk on the ceiling fan.

  4. Actually, I was attempting to write cat code, and accidentally wrote html. Which is funny, because I don’t actually know how to write HTML.
    It was supposed to read (without brackets and equal signs, etc.):
    If (human object) does not have (goal)food, hide behind door and pounce on human in order to kill (target human object). If human catches you, sit and wash paw.
    Then maybe go ninja on the ceiling fan.

  5. Yes, but Kirk looked better with his shirt off.

    ……………

    In the original series, that is.