HOME

### Who's in the Garden? Suppose you want to build a truth table that tells whether or not a groundhog will be in a garden. Whether or not the groundhog is in the garden is based on whether or not other beings are in the garden.

In our scenario, we worry about the presence, or absence, of three different beings -- the master, the cat, and the dog. Whether or not a being is present is either true or false. In our truth table, "0" indicates false, and "1" indicates true. So we have three different questions to answer every time we want to determine whether or not the groundhog is in the garden. There are eight different possible scenarios. Lets go through them one by one.

 `Line Number 1.` `The inputs are 000.` `c = 0;` `d = 0;` `m = 0;` `Is the cat in the garden? c = 0, indicating "false".` `Is the dog in the garden? d = 0, indicating "fasle".` `Is the master in the garden? m = 0, indicating "false".` `Because no one is in the garden, the groundhog would feel safe being in the garden. Therefore, the groundhog is in the garden, and g = 1.` `As a result, line number 1 looks like this -> 000:1`

 `Line Number 2.` `The inputs are 001.` `c = 0;` `d = 0;` `m = 1;` `Is the cat in the garden? c = 0, indicating "false".` `Is the dog in the garden? d = 0, indicating "fasle".` `Is the master in the garden? m = 1, indicating "true".` `Because the master is in the garden, the groundhog wouldn't feel safe being in the garden. Therefore, the groundhog is not in the garden, and g = 0.` `As a result, line number 2 looks like this -> 001:0`

 `Line Number 3.` `The inputs are 010.` `c = 0;` `d = 1;` `m = 0;` `Is the cat in the garden? c = 0, indicating "false".` `Is the dog in the garden? d = 1, indicating "true".` `Is the master in the garden? m = 0, indicating "false".` `Because the dog is in the garden, the groundhog wouldn't feel safe being in the garden. Therefore, the groundhog is not in the garden, and g = 0.` `As a result, line number 3 looks like this -> 010:0`

 `Line Number 4.` `The inputs are 011.` `c = 0;` `d = 1;` `m = 1;` `Is the cat in the garden? c = 0, indicating "false".` `Is the dog in the garden? d = 1, indicating "true".` `Is the master in the garden? m = 1, indicating "true".` `Because the master and the dog are both in the garden, the groundhog wouldn't feel safe being in the garden. Therefore, the groundhog is not in the garden, and g = 0.` `As a result, line number 4 looks like this -> 011:0`

 `Line Number 5.` `The inputs are 100.` `c = 1;` `d = 0;` `m = 0;` `Is the cat in the garden? c = 1, indicating "true".` `Is the dog in the garden? d = 0, indicating "false".` `Is the master in the garden? m = 0, indicating "false".` `The groundhog isn't afraid of the cat. Because the cat is the only one in the garden, the groundhog would feel safe being in the garden. Therefore, the groundhog is in the garden, and g = 1.` `As a result, line number 5 looks like this -> 100:1`

 `Line Number 6.` `The inputs are 101.` `c = 1;` `d = 0;` `m = 1;` `Is the cat in the garden? c = 1, indicating "true".` `Is the dog in the garden? d = 0, indicating "false".` `Is the master in the garden? m = 1, indicating "true".` `Because the master is in the garden, the groundhog wouldn't feel safe being in the garden. Therefore, the groundhog is not in the garden, and g = 0.` `As a result, line number 6 looks like this -> 101:0`

 `Line Number 7.` `The inputs are 110.` `c = 1;` `d = 1;` `m = 0;` `Is the cat in the garden? c = 1, indicating "true".` `Is the dog in the garden? d = 1, indicating "true".` `Is the master in the garden? m = 0, indicating "false".` `The cat and the dog don't like each other and will never be in the garden together by themselves. Therefore, this is a scenario that won't happen. Because it won't happen, we need not concern ourselves about whether or not the groundhog would be in the garden. Because we don't care about this scenario, g = X.` `As a result, line number 7 looks like this -> 110:X`

 `Line Number 8.` `The inputs are 111.` `c = 1;` `d = 1;` `m = 1;` `Is the cat in the garden? c = 1, indicating "true".` `Is the dog in the garden? d = 1, indicating "true".` `Is the master in the garden? m = 1, indicating "true".` `The dog and cat are in the garden, but they are not by themselves. The master is there to control the dog and protect the cat. So this is a valid scenario. Because the master and the dog are both in the garden, the groundhog wouldn't feel safe being in the garden. Therefore, the groundhog is not in the garden, and g = 0.` `As a result, line number 8 looks like this -> 111:0`