the-honk/school/a-level/Y12 2022-2024/Logic/Framework.py

30 lines
620 B
Python
Raw Normal View History

2024-10-09 17:02:48 +00:00
from __future__ import annotations
from enum import Enum
class Gate(Enum):
AND = '^'
OR = ''
XOR = ''
NAND = ''
NOR = ''
XNOR = ''
class Symbol():
def __init__(self, symbol, initialValue):
self._symbol = symbol
self._value = initialValue
self._tree = []
def setValue(self, newValue):
self._value = newValue
return self
def AND(self, symbol: Symbol):
self._tree.append((Gate.AND, symbol))
return self
def compute():
def __str__(self):
return self._symbol