To gain experience building circuits which use switches to compute logical expressions.
In Code, Petzold designs a circuit to decide if a cat is acceptable according to a logical expression. This is used to illustrate the link between logic and circuits. His circuit is given below:
Below is a Logisim version of the same circuit:
This circuit uses transistors controlled by pins instead of switches which would need to be opened and closed manually. A pin is an input or output of a circuit. Whether the cat is male or female is external to the circuit, so is controlled by a pin.
When the value of (M & N & (W | T)) | (F & N & ~W) | B is true, then the LED will light up. Notice that the ~W is handled with a P-type transistor which closes when a 0 is coming in. The other transistors are all N-type which close on a 1.
You can download this circuit here.
For this lab, you'll build a circuit along similar lines which will compute who wins a game of rock, paper, scissors. In this game, two players throw hand signals representing rock, paper, and scissors. The moves are compared and a winner is decided according to the following rules:
Your circuit should determine a winner based on the moves of each player.
You should build the circuit out of the following components:
You should use 6 pins (found under the wiring menu). Three pins are for player 1, and three are for player 2. Each player has a rock, paper, and scissors pin.
You should change them from three-state pins to two-state pins in the properties menu. Three-state pins can also be "turned off" where they do not represent a 0 or a 1, but that's not needed for this circuit.
You should also label each pin, so it's clear what it does!
For each switch, you'll need a transistor connected to the appropriate pin. Be sure to select the right type between P-type and N-type.
Each transistor needs a power source on the collector (left side). Whether they each have one, or share one doesn't matter.
You should have two LEDs: one which represents player 1 winning, and another which represents player 2 winning. A tie game would be indicated with both LEDs off. Under no conditions should both LEDs be on!
Be sure to test that your circuit lights the appropriate LEDs for each possibility. You should test the case where the players throw the same moves (resulting in a tie), and when no move is thrown.
You don't need to test the case where multiple throws are selected (e.g. if the pins for player 1 throwing rock and paper are both on).
Copyright © 2019 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.