O'Reilly logo

Programming Game AI by Example by Mat Buckland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using mathematical notation these sets can be written as:
Odd = {1, 3, 5, 7, 9, 11, 13, 15}
Even = {2, 4, 6, 8, 10, 12, 14}
As is evident, the degree of membership of a number to a crisp set is either
true or false, 1 or 0. The number 5 is 100 percent odd and 0 percent even.
In classical set theory all the integers are black and white in this way —
they are members of one set to a degree of 1 and to the other to a degree of
0. It’s also worth highlighting that an element can be contained in more
than one crisp set. For example, the integer 3 is a member of the set of odd
numbers, the set of prime numbers, and the set of all numbers less then 5.
But in all these sets its degree of membership is 1.
Set Operators
There are a number of operations that can be performed on sets. The most
common are union, intersection, and complement.
The union of two sets is the set that contains all the elements from both
sets. The union operator is usually written using the symbol È. Given the
two sets A = {1, 2, 3, 4} and B = {3, 5, 7}, the union of A and B can be
written as:
(10.1)
The union of two sets is equivalent to ORing the sets together — a given
element is in one OR the other.
The intersection of two sets, written using the symbol Ç, is the set con-
taining all the elements present in both sets. Using the sets A and B from
above, their intersection is written as:
(10.2)
The intersection of two sets is equivalent to ANDing the sets together.
Using our two sets above there is only one element that is in set A AND in
set B, making the intersection of sets A and B {3}.
The complement of a set is the set containing all the elements in the uni
-
verse of discourse not present in the set. In other words, it is the inverse of
the set. Let’s say the universe of discourse of A and B is A õ B as given in
equation (10.1), then As complement is B, and B’s complement is A. The
complement operator is usually written using the ' symbol, although some
-
times it is denoted by a bar across the top of the set’s name. Both options
are shown in equation 10.3.
(10.3)
The complement operator is equivalent to NOT.
418 | Chapter 10
Crisp Sets
{}
1, 2,3,4,3,5, 7ABÈ=
{}
3ABÇ=
'AB
BA
=
=

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required