Follow my updates with RSS

The Blueprint of a Cat

It would have been quite a bit easier to outline what a cat should do if I were, in fact, a cat. As it happens though, I am not a cat, not even a little bit of a cat. Labelling myself as a “cat person” may have confused you there but this was just to say that I think cats are great animals, fantastic pets and one of the few animals that, if nothing else, make hilarious video montages.

My JavaScript Cat’s requirements aren’t going to come from the mind of a cat, requirements that I expect wouldn’t be much more than:

  1. Find nice sunny window-sill to sleep on
  2. No matter where I am, arrive home and start meowing when owner rattles the cat biscuit box
  3. Attack own shadow, fall off bench, jump ridiculously high at unexpected noises or something similarly comedic when a video camera is around

No, my JavaScript Cat will be modelled on what I have observed of these domesticated felines and… actually, scrap that. My observations include all of the points listed above, maybe I am a cat?

What Should a JavaScript Cat Do?

Writing Artificial Intelligence is not easy and I’m sure that anyone who actually specialises in this or does it for a living will be mildly entertained at what I am attempting to do. People in this field will be well aware of the challenges I will encounter. I know I won’t be reproducing the incredible AI found in games like F.E.A.R but it is something that has always fascinated me and I thought, why not give it a shot using a scripting language about as high up in the computer hierarchy as possible? I mention this because I initially tried jumping straight in an writing the script for a cat. I got as far as defining the class “cat” before reaching the first hurdle “What’s it going to do?”

The Behaviours Essential To Survival

A cat is a living, breathing animal so it makes sense that it performs the actions necessary to survive. This first set of requirements is a logical listing defining what this JavaScript cat is going to have to do to live. It also serves as a definition of scope, omitting such subconscious actions as heartbeats, breathing and blinking.

Drink Water
The cat is going to have to keep its fluids up by drinking water. Water will have to be available somewhere so that when needed, the cat can wander over and have a sip.
Eat
Regardless of how recently it was fed, I am yet to see a pet that doesn’t perk up when food comes around. The cat is going to have to eat when it gets hungry, or when there isn’t much else to do.
Sleep
This is a given for your average puss. Cats sleep around 19 hours a day so as well as being essential to survival, it must be quite enjoyable.
Activity
Obesity is plaguing the Western World and if you look at some “Family Friendly” news stories, you will see that it is also affecting out furry friends. So that the cat doesn’t get so fat it has to ride a skateboard around, it should get some regular physical activity.
Maintain Instincts
Cats are very alert and instinctive animals and such traits shouldn’t be removed from an artificial one. Noises should wake even a sleeping cat and it should maintain the “Oh! It moved!” POUNCE instinct.

The Behaviours Essential To Hilarity A Pet

It’s obvious really, we wouldn’t have cats as pets if they weren’t a good bit of fun. Cats are great fun to razz up so they attack everything or pat so they curl up and purr off to sleep; a JavaScript cat should attempt to maintain some of these aspects.

Playfulness
Most cats will play with you quite happily when they feel like it. They will even start their own games (like attacking the dog or crash tackling your foot as you walk down the hallway) when they’re in the right mood. The JavaScript cat should be up for a game occasionally but not all the time because there’s sleeping and general ignoring-of-you to be done.
Friendliness
In my experience, a cat is your best friend if there is food about but at other times it will rub against your legs talking to you, curl up on your lap and have a nap or bring a freshly killed mouse into the living room. These sort of helpful traits should carry across to a JavaScript cat where possible.
Inquisitiveness
Put a box containing a small rattle next to a cat and it won’t be long before puss strides over for a look. As youTube videos suggest, any loud noise while a cat has it’s head in a box will result in quite an entertaining reaction but put another box there the next day and the cat will probably still take a look. The JavaScript cat should be willing to investigate any oddities it sees lying about.
React To Familiar Noises
I have never had a cat that didn’t appear as soon as the biscuit box is given a shake or react in some way to its name (even if that reaction is to look at you and take no further action). This cat should be able to recognise such noises.

There Could Be More, The Code Will Tell

Keep an eye on this list as it may evolve as I piece together the code. From now on, my posts regarding the cat will be about specific challenges I have overcome, demo scripts I have put together and general observations about writing Artificial Intelligence in a scripting language designed to make website forms interactive.

For now though, I can tell you that I have begun writing the script and I am getting some very funny cats indeed. Once I can get puss to stop jumping out of windows and drowning in water bowls, I will be nowhere near finished.

See you next time.

VN:F [1.4.6_730]
Rating: 5.0/5 (2 votes cast)

Tags: , ,

4 Responses to “The Blueprint of a Cat”

  1. jan chips in with:

    this sounds like a lot of fun!!!
    i can’t wait to see the first digital-feline prototypes.

    VA:F [1.4.6_730]
    Rating: 0.0/5 (0 votes cast)
  2. Rakuli chips in with:

    Yeah, it’s that mind-grindingly frustrating type of fun :D Trying to get the cat to do what a cat should do is a good laugh if nothing else.

    VN:F [1.4.6_730]
    Rating: 0.0/5 (0 votes cast)
  3. Jan chips in with:

    what’s the cat up to? i’m really interested in this project!!! maybe i’ll give something similar a try myself!

    VA:F [1.4.6_730]
    Rating: 0.0/5 (0 votes cast)
  4. Rakuli chips in with:

    I’m interested too of course. The cat is well fed but I had to send it to a friend’s while I’ve been busy in both like and work. Hopefully, I can give it some attention soon but I’m not sure how I confident I am with that.

    VN:F [1.4.6_730]
    Rating: 0.0/5 (0 votes cast)

Leave a Reply