Home CPSC 305

Switch Exercise



To gain experience building circuits which use switches to compute logical expressions.


Cat Selector Circuit

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.


Exercise: Rock, Paper, Scissors

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:



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).



When your circuit works, email the .circ file to ifinlay@umw.edu.

Copyright © 2022 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.