CNA Samples

Fuzzy Logic

Ported from Microsoft's XNA 4.0 Fuzzy Logic sample.

Source for this sample on GitHub ↗

A red tank chasing white mice beneath Distance, Angle and Time weight bars. Play ▸

Opens in a new tab. Select a weight with Up/Down, change it with Left/Right, or drag a bar by touch.

About this sample

A tank pursues fifteen mice while the mice wander and evade it. The tank combines fuzzy assessments of each mouse's distance, angle and time already spent chasing it to choose a target. Change the three weights to see how its choices shift. The sample also demonstrates reusable Chase, Wander and Evade behaviors.

Controls

ActionKeyboardTouchGamepad
Select a weightUp / DownTouch its barLeft stick or D-pad Up / Down
Change a weightLeft / RightDrag left / rightLeft stick or D-pad Left / Right
ExitEscape—Back