Page 1 of 1

Electrical puzzle

Posted: Mon Feb 09, 2009 6:17 pm
by Roger
Here's a puzzle you may have heard before which you can build as a simple electric circuit. First, the puzzle: a farmer is traveling to market with his cat, a chicken and some corn. He has to cross a river, and the only way to cross is in a small boat which can hold the farmer and just one of the three items he has with him. The problem is, he has to be very careful about what he chooses to leave behind at any time. If the cat and chicken are left alone, the cat will eat the chicken. If the chicken and the corn are left alone, the chicken will eat the corn. To solve the puzzle, you must show how the farmer can get himself and his three items across the river without losing any of them. The goal of this project is to design a simple electrical circuit that follows the puzzle. You'll need a 6 V battery, a flashlight bulb, a bulb holder, some connecting wire, and four toggle switches: 3 SPDT (single-pole, double throw) and 1 DPDT (double-pole, double throw). Each switch represents one of the items: the farmer, the cat, the chicken and the corn (you have to figure out which need to be SPDT switches and which one needs to be a DPDT switch). The switches are mounted on a small panel, in a horizontal row (representing the river, which you can draw in). Each switch is labeled ("Farmer", "Cat", "Chicken", "Corn"). The circuit is to be designed so that if either of the problematic pairs (cat-chicken, or chicken-corn) are left alone on the same side of the river, the light bulb lights up, indicating an incorrect solution (you can add a 6 V buzzer, too, if you like). Since the boat can hold only two items, players can use only two switches per "move". Irwin Math's book, Wires and Watts: Understanding and Using Electricity has the solution (Math, 1981, 67–70), but see if you can figure this one out on your own.
The puzzle I've got figured out but I am stuck on the wiring and cannot find an Irwin Math book.

Re: Electrical puzzle

Posted: Tue Feb 10, 2009 8:23 am
by deleted-71588
These kinds of problems are usually referred to as "logic" problems and there is ususally some "state" associated with each "variable". In order to describe the combinations (permutations) and outcome (good - light off / bad - light on), you have to describe the "states" each variable can be in. So how do you assign arbitrary "state names" that are meaningful so that when you have worked out a solution, it makes sense? The "labeling" step is often a stumbling block. In this case, if you were to imagine standing in the river facing the water coming at you, there would be a "left" bank and a "right" bank.

If all four things (variables) {farmer, cat, chicken, corn} were on the left bank, that is ok because the farmer can control the cat and chicken. What if the farmer goes to the right bank and the rest remain? By taking one and only one variable to the right bank at a time, you get 4 permutations. By taking one and only one thing to the left bank at a time, you get another 4 permutations. By taking 2 things at a time to the right bank you get 3+2+1 or 6 permutations. Add in the two cases where everything is on one bank and you have all of the 16 possible permutations. Do some research on "permutations" and "truth tables" to better understand these.

If you build a table with 5 colums (one for each of the four independent variables and one for the output) and 16 rows (one for each permutation L/R combintations on the variables and ON / OFF) you can build what is usually called a "truth table". So what does this table do to help? Well, it becomes a "test plan". In order to work as intended, your circuit behavior must match this truth table for all switch combinations.

After you build your truth table and stare at it for a while, you will notice that all the "failure cases" (ones where problem light is to be on) occur when the farmer is not on the same bank as the chicken. Further, the chicken and either the corn or the cat have to be on the same bank. If you break down this last bit of logic using by introducing a "don't care" concept and only look at the cat/chicken issue, it doesn't matter where the corn is. Introducing a "don't care" concept looking at the chicken/corn issue, it doesn't matter where the cat is.

Do some research on "ladder diagrams" and "parallel" and "series" connections. Ladder diagrams are a way of showing switch contacts and forming circuits that are "rungs" between two "rails". For battery circuits, traditionally, the one rail would be connected to the positive battery terminal and the other connected to the negative terminal and there would be one or more "loads" (light bulbs in your case) at the right end of a rung.

How do you go from the "truth table" and "observed logic" to a ladder diagram and minimize the number of switch contacts used? That is an art and learned manipulative skills. In this case, you were "given" a set of 4 switches, one DPDT and three SPDT which is a huge hint at an implementation. Which is the more complicated switch? I'll bet it has to be used for the variable that is in the middle of it all and has the most complex relationships to the other variables in terms of combinations.

Look up "three way" and "four way" light switches. This jargon is historic and a bit confusing. A residential "two way" switch circuit is a simple ON/OFF switch at a single point. A "three way" switch circuit is a way of turning a light on/off from two locations. A "four way" switch circuit is a way of turning a light on/off from three locations.

If you make use of the don't care observations, you should be able to transform each of them into a "four way" light switch circuit and if you put the farmer on the left and the chicken in the middle of each of these "four way" switch circuits, you should see that the farmer and chicken portions are identical so their rungs are in "series" with two "parallel" sets of cat and corn rungs.

Lots of luck.

Re: Electrical puzzle

Posted: Tue Feb 10, 2009 9:33 am
by deleted-2574
Hi Roger,

If you still need the book after Craig_Bridge's explanation, apparently the book is out of print but is available from many third party resellers. If you do a search for "Irwin Math Wires and Watts: Understanding and Using Electricity" on amazon.com, you can find them.

I've never purchased a book using an amazon third party reseller (only directly from amazon). amazon suggests researching the sellers.

[links removed]

Re: Electrical puzzle

Posted: Wed Mar 13, 2013 6:08 pm
by jlaw58
My daughter has been working on this project and has finished the build. Everything works. However, she wants to be able to explain which logical gates she has used (i.e. NOT, AND, OR, NAND, NOR, XOR, XNOR) but is having trouble translating the 4-input truth table into which. Are there any tips, explanations or other help anyone can give? Thank you.

Re: Electrical puzzle

Posted: Sun Mar 17, 2013 9:00 pm
by deleted-73970
Hi jlaw58,

Glad to hear that the build works! However, if she's having trouble translating the 4-input truth tables, which can get messy, she might like the idea of Karnaugh Maps. She can read about "K-maps" here: http://www.facstaff.bucknell.edu/mastas ... ogic3.html. They are meant to simplify truth tables with three or more variables, so that patterns can be more easily recognized. That's one tip I can give you, and I'm sure there are plenty more that other Experts can offer, so keep your eyes peeled!