Simple 3-bit Light Computer

This computer is essentially 3 of our Simple 1-bit Light Computers combined. Three bits per instruction allows for up to 8 different instructions. This computer use all 8 possible instructions (one for each color: red, green, blue, yellow, magenta, cyan, black, white).

This computer can be programmed in binary (1’s and 0’s) just like the One Bit Light Computer. Each binary instruction for this computer will consist of 3 bits (one for red, one for green, and one for blue). So to program the color “red”, you’d use the bits 100 (red on, green off, blue off). You can combine bits for other colors (like magenta: 101 – red on, green off, blue on). The full table is given below.

This computer can also be programmed with a simple “computer language”. A computer language is a language that we (people) can use to “talk” to a computer in a “language” that we both understand. There are hundreds (maybe thousands) of computer languages that have been invented. Each language has its own features, advantages, and disadvantages. This simple language uses a single letter to specify one of the 8 possible colors (red, green, blue, yellow, magenta, cyan, black, and white). The first letter of each color is the “computer language” instruction for that color with the exception of using “k” for black (since “b” is already used for blue). Here’s the table:

ColorSOURCE code instructionMachine code instruction
Redr100
Greeng010
Blueb001
Yellowy110
Magentam101
Cyanc011
Blackk000
Whitew111
Instruction table for Three Bit Color Light Computer

Because this computer supports both Source Code input and Binary Code input, there are 2 text entry boxes in the simulation. The box on the left (“Source Code”) accepts the instruction letters as shown above (r, g, b, y, m, c, k, w). The box on the right (“Binary Code”) accepts binary instructions (100, 010, 001, 110, 101, 011, 000, 111) that will be run by the computer. While you can enter binary instructions directly into the “Binary Code” box and run it, you can also enter color letter instructions into the “Source Code” box and push the “Compile Program” button to translate your “human friendly” instructions into binary. In either case, the resulting binary program can be loaded into the simulator’s memory using the “Load Program” button.

You can run this computer simulation using this link: Three Bit Color Computer

You can also download this simple simulation below. It will be a “ZIP” file which can be unpacked with most operating systems. The unpacked file will be named Simple_3Bit_Light.html. If you double click on that file it should open the simulation in your web browser.

To run the simulation, enter a short program in the “Source Code” box on the left. Try the pattern ggggggyyyrrrrr which will produce the common traffic light colors (green to go, yellow as a warning, and red to stop). Then click the “Compile Program” button. This will translate (compile) your source code into binary code in the “Binary Code” box. Then click the “Load Program” button to copy the program into Memory. Finally, click the “Run/Stop” button (upper right) to make the computer actually run the program from Memory. It should look similar to the simulation above (depending on your program). You can speed it up by changing the number of instructions per second using the selection button below the blinking light. Try using 4 instructions/sec for a good pace. Try out other patterns like a flashing caution light (“yk“) or a patriotic red, white, and blue (“rwb“). Make a “strobe light” with a program like kkkkkkkkkkwkkkkkkkkkk. Experiment with running at different speeds. You can stop and restart the program with the “Run/Stop” button, and you can use the “Step” button to step through each instruction when the computer is stopped. Remember that the simulation will highlight the NEXT instruction to be executed.

Play with it. It’s all software, so you can’t hurt anything!