新增轻量级逻辑模拟器包与半加器示例 - #1
Open
ColorLog wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
README:逻辑模拟器/README.md,包含功能说明、快速开始和预期输出示例。logic_simulator/core.py,包含and_gate,or_gate,not_gate,xor_gate,nand_gate,nor_gate,以及Gate和Circuit两个数据结构,支持通过Circuit.add_gate组装电路并用Circuit.run计算输出。logic_simulator/__init__.py,并添加运行示例examples/half_adder.py,示例通过运行打印四种输入下的SUM与CARRY。Testing
python examples/half_adder.py并验证输出与 README 中的预期输出一致,测试通过。python -m py_compile '逻辑模拟器/logic_simulator/core.py' '逻辑模拟器/logic_simulator/__init__.py' '逻辑模拟器/examples/half_adder.py',编译检查通过。git status),无异常信息。Codex Task