# Degrees of Truth: Fuzzy Logic

February 23, 2018

On to fuzzy logic, which is by far the AI technique with the cutest name. It was first formally developed by Dr. Lotfi Zadeh in 1965 and has since then been used in a variety of implementations and projects.

The simple explanation is that while non-fuzzy (called crisp or bivalued logic) values are Binary/Boolean, meaning they can either be true or false, 0 or 1. Fuzzy logic attempts to smoothen the transition between states by using the intermediate values between those extremes, In this case anything between 0 and 1. It is used to deal with subjective data that does not lend itself to either of two extremes. A small example follows.

There is a character in a game. If his speed, which ranges from 0 to 1 is over 0.5 the character is considered to be running. Anything lower and the character is walking. The character can either be running or walking. The minute it changes state the speed and animation change immediately.

In the fuzzy version of this the character would have a membership in both states with the characters speed determine the amount via a membership function. In this example the membership is very simple with 0.5 being a perfect midpoint of the two states and every 0.1 meaning an increase of 10% of the appropriate state. If we then use that to perhaps control the characters animation and speed to the percentage of that value we can get a more realistic behaviour without the jarring transition the previous example had.

Because of this ability to have degrees of truth we can more accurately model a complex behaviour by giving a larger variety of responses which correspond more with the way humans think.Fuzzy logic can be applied in numerous AI techniques, prominent examples being the two previously mentioned in this blog, finite state machines and expert systems with the latter being an excellent fit for a fuzzy system due to their reliance on rules and tested variables.

In games development the fuzzy value is usually “de-fuzzified” (there are a variety of methods to do so such as the means of maxima) as dealing with crisp values tends to have a lower development cost. In extreme cases where the uncertainty is high, the degrees numerous enough, the computational demands can become increasingly massive.

REFERENCES

Rouse, Margaret. (2016). Fuzzy Logic

Available from: http://whatis.techtarget.com/definition/fuzzy-logic

Computerphile. (2014). Fuzzy Logic  - Computerphile