Fuzzy Logic


Intro

Binary Logic

Fuzzy Logic

Fuzzy Set

Chicalm

Washing Machine

History

Books



Playground

Rapunzel

Dido's Problem

Pythagoras

Trigonometry

Smart Joe

Fuzzy Logic

Cryptography

Mathematicians



To show you how fuzzy logic can be used in making computer programs, let's take a look at Chicalm, a dog game. But first we'll have to take a look at a few facts about dog behaviour. When two dogs meet, they use many different body signals to show each other how they feel. The most important signals are the calming signals used to show the other dog that no harm is meant. In this game you have control over a tiny Chihuahua. You can make it lie down, sit down, go into the playing position, and turn its head (these are all calming signals), and you can make it walk. It meets a big dog and you have to make it act in a way so that it doesn't get eaten.

The code for the big dog deals with whether to eat the Chihuahua or not. To do that, the code keeps track of the big dog's aggression level. In every level the starting point of the aggression level is a bit higher. The calming level always gets subtracted from the aggression level. If the resulting level gets too high, it's bye bye Chihuahua.

To calculate the calming level, fuzzy logic is used. Dogs react differently to calming signals depending on the distance between them. When they are a short distance away from each other, they react well to the turning of the head, while at large distances, lying down seems to work best. At medium distances, getting into play position and sitting work best. The Chicalm game uses the following graph to determine the calming level of a calming signal.


 

When dogs get aggressive they don't think as clearly. This means that it is better for the little dog to lie down even at a small distance when the other is already aggressive. The aggressive dog needs a stronger signal to get the same effect. To get this into the game, the aggression level of the big dog is added to the distance before determining the calming level.

The last signal the big dog can react to is walking away. Among dogs it is extremely rude to walk away before having been properly sniffed. For every step the Chihuahua takes, the big dog follows and its aggression level is increased. The Chihuahua has no chance to dodge past. Of course, once the big dog has finished sniffing, he no longer cares about the Chihuahua. Now the Chihuahua can safely run to the other side of the screen.

Try out Chicalm!

Read more about dogs language and calming signals


Previous Next