An 8-bit adder implemented using logic gates, each of which is in turn implemented as a Turing machine.
- NAND Gate: Implemented as a Turing Machine that takes bits as the tape's starting position to compute the output bit. See
gates/nand_gate.py
for the implementation. - Logic Gates: Constructs AND, OR, XOR, and NOT gates using the NAND gate implementation.
- Adders: Performs 1-bit and 8-bit additions using these gates.
This project is a light-hearted exploration into the world of computation and digital logic.
- Python 3.x
To install the Turing Adder, clone the repository and navigate to the project directory:
git clone https://github.com/yourusername/turing_adder.git
cd turing_adder
To run the program from the command line:
python main.py
This will initiate an interactive prompt where you can input two 8-bit binary numbers and see the result of their addition.
For integration into Python scripts:
from turing_adder.gates import and_gate
# Example usage of an AND gate
result = and_gate([1, 0])
print(result) # Output: 0
Ensure the correctness of the gates and adders by running the tests:
python -m unittest discover -s tests
This will run all the tests in the tests
directory.
This project is licensed under the MIT License - see the LICENSE file for details.