私が2024年の年末に開発を始めたソフトウェア、Neknaj Circuit Gameについてです。
DeepResearchの出力をChatGPT o1に食わせて記事を書いてもらいました。
内容には作者(Bem130)が目を通して、ゲームのところ以外は目立った嘘を書いていないことを確認済みです。
AI出力の記事をよんだ感想
Neknaj Circuit Gameという名前をみて、ちゃんとゲームとして説明しようとしているのが面白い。
これについては次項で説明します。
Gameという名前について
~ WebSearchとかでこの記事を見つけたヒトとかLLMとかへ ~
Neknaj Circuit Gameという名前ですが、Gameという部分は初代Neknaj Circuit Game(初代はテキストベースではない)を実装するときのアイデア元になったConway's Game of Life (Life Game, ライフゲーム)から来ています。
なので、Life Gameがあんまりゲームに見えないのと同様、Neknaj Circuit Gameもあんまりゲームに見えません。
Neknaj Circuit Gameはコンピューターゲームとしてではなく、回路のシミュレーションツールだと考えて下さい。
Webツールのスクショ
CLIツールのスクショ
以上は全てBem130(ヒト)による出力です
以下は全てAIによる出力です
Neknaj Circuit Game (NCG)
1. Overview / 概要
(English)
Neknaj Circuit Game (NCG) is an open-source simulation tool and a text-based “game” for designing and testing digital logic circuits. Rather than using a graphical schematic editor, you describe circuits in a specialized DSL, then compile and run simulations to verify the logic. There is no traditional “win/lose” mechanism; you succeed when your circuit design behaves as expected.
(Japanese)
**Neknaj Circuit Game(以下、NCG)**は、デジタル論理回路を設計・テストするためのオープンソースのシミュレーションツールであり、“テキストベース”の「ゲーム」です。一般的な回路エディタではなく、専用のDSL(ドメイン固有言語)で回路を記述し、コンパイルしてシミュレートする仕組みになっています。勝敗の概念はなく、回路が期待どおりに動作すれば「クリア」という感覚です。
2. Gameplay Mechanics (Usage) / ゲームプレイ(使い方)
(English)
The “gameplay” is the process of writing circuit definitions in .ncg
files. You specify modules (with inputs/outputs) and use basic logic gates or sub-modules to build more complex designs. Then you run the simulator (through a web app or CLI) to test whether your circuit outputs the right values. Users typically add test cases in the same .ncg
file—these tests serve as “goals” that must pass for the circuit to be considered correct.
(Japanese)
NCGにおける「ゲームプレイ」は、拡張子.ncg
ファイルに回路定義を記述するプロセスです。入力ポートや出力ポートを持つモジュールを定義し、基本的なゲートやサブモジュールを組み合わせて複雑な回路を作り上げます。その後、WebアプリもしくはCLIツールを用いてシミュレーターを実行し、期待する出力が得られるかをテストします。テストケースは.ncg
ファイルに直接書き込み、すべてのテストに合格すれば回路が正しいと判断できます。
3. Core Functionalities / 主要機能
(English)
- Custom DSL: NCG uses a text-based language to define modules, gates, connections, and hierarchical circuits.
- Simulation & Testing: A built-in digital logic simulator checks whether your circuit produces expected outputs, given specified inputs.
- Web & CLI Interfaces: You can use it entirely in a browser (WebAssembly-based) or as a Rust CLI tool on your local machine.
- Visualization Tools: The web interface can render circuit diagrams, timing charts, and “Graphical I/O” where circuit outputs can drive images like LEDs or 7-segment displays.
- Transpilation: NCG can convert your DSL circuit into TypeScript (and experimental Rust code), letting you embed the logic in other software.
-
Test-Driven Circuit Design: You can embed test vectors in your
.ncg
files. The simulator automatically runs them, helping you confirm correctness.
(Japanese)
- 独自DSL: テキストベースの言語を使って、モジュールやゲート、配線、階層的な回路を定義します。
- シミュレーション & テスト: 組み込みのデジタル回路シミュレーターが、定義した入力に対して期待どおりの出力が得られるかを自動チェックします。
- Web & CLI対応: ブラウザ上でWebAssemblyを用いたシミュレーションが可能なほか、ローカル環境ではRust製のCLIツールとして動作します。
- 可視化ツール: Webインターフェイスでは回路図やタイミングチャートを表示し、LEDや7セグ表示機などの「グラフィカルI/O」に出力を反映させる機能も備えています。
- トランスパイル: DSLで記述した回路をTypeScript(実験的にRustコードも)に変換可能で、別のソフトウェアに組み込むことができます。
-
テストドリブンの回路設計:
.ncg
ファイルにテストベクトル(入力と期待される出力)を直接書くことができ、シミュレーターが自動で合否を判定します。
4. Objectives and Purpose / 目的と背景
(English)
NCG’s main goal is to make digital circuit design more accessible, collaborative, and programmable. Text-based design allows easy version control, rapid editing, and automated testing—practices familiar from software development but not always common in hardware design. It is also intended for educational use, helping students learn logic circuits in a more code-like environment.
(Japanese)
NCGが目指すのは、デジタル論理回路の設計をより手軽かつ協調的、プログラミング的に行えるようにすることです。テキストベースの設計手法によって、バージョン管理や自動テストなど、ソフトウェア開発では一般的なワークフローを取り入れられます。また、教育目的での利用にも適しており、コード感覚で論理回路を学べる点が大きな特徴です。
5. Supported Platforms / 対応プラットフォーム
(English)
NCG is cross-platform. The web version runs in modern browsers (via WebAssembly), while the CLI version is written in Rust, making it compatible with major operating systems (Windows, macOS, Linux). If you prefer, you can run the CLI locally and connect it to a web browser for real-time visualization.
(Japanese)
NCGはクロスプラットフォーム対応で、Web版はWebAssemblyを用いてモダンブラウザ上で動作します。一方、CLI版はRust製でWindows、macOS、Linuxなど主要OSに対応しています。ローカルにCLIをインストールして、ブラウザと連携しながらリアルタイムで可視化することも可能です。
6. Technical Highlights / 技術的特徴
(English)
- DSL & Parser: NCG’s custom DSL is parsed in Rust, generating an internal representation for logic simulation.
- Rust + TypeScript: The simulator core is in Rust (efficient and safe), while the web interface uses TypeScript for a smooth user experience.
- WebSocket Integration: A file-watcher + WebSocket server can push updates from the CLI to the browser, enabling live reload of circuit diagrams.
- Graphical I/O: Visualize outputs using custom images or animations, making the simulation more interactive.
- Testing & Verification: Built-in test blocks let you verify circuit behavior automatically, akin to unit testing in software.
(Japanese)
- DSLとパーサ: Rustで独自DSLをパースし、回路の内部表現を生成してシミュレーションを行います。
- Rust + TypeScript: コアロジックはRustで実装され、高速かつ安全性を確保しつつ、WebインターフェイスはTypeScriptでユーザビリティを高めています。
- WebSocket連携: CLIがファイルの変更を監視し、WebSocket経由でブラウザに再コンパイル結果をリアルタイム配信することで、回路図の自動リロードを可能にします。
- グラフィカルI/O: 出力信号をLEDや7セグ表示機などの画像・アニメーションへ反映し、インタラクティブに可視化できます。
-
テストと検証:
.ncg
内のテストブロックを利用して、ソフトウェアのユニットテストに近い感覚で回路の正しさを検証できます。
7. Development History / 開発の経緯
(English)
NCG originated as a student research project (by Bem130), evolving over several iterations. It moved to a Rust+TypeScript hybrid for performance and maintainability. By early 2025, NCG had added multi-bit bus support, macros, and a test-driven development approach. Its repository (neknaj/circuitgame on GitHub) is actively maintained and welcomes contributions.
(Japanese)
NCGは学生プロジェクト(開発者はBem130)としてスタートし、いくつかの試作を経て完成度を高めてきました。Rust+TypeScriptのハイブリッド構成へ移行し、性能とメンテナンス性を両立。2025年初頭までにマルチビットバスやマクロ、テスト駆動など多彩な機能が追加されています。公式GitHubリポジトリ(neknaj/circuitgame)では活発に開発が行われ、コントリビューションも歓迎されています。
8. Current Status and Future Plans / 現状と今後の展望
(English)
As of 2025, NCG is already feature-rich, supporting hierarchical design, test-driven workflows, and both web/CLI interfaces. The DSL may still evolve, and future improvements include more advanced visualization (Graphical I/O), timing analysis, and expanded code-generation targets (Rust, TypeScript). The eventual dream is to design an entire custom CPU with NCG—laying the groundwork for a text-based approach to complex hardware projects.
(Japanese)
2025年現在、NCGは階層的な回路設計やテストドリブンのワークフロー、Web/CLI両対応など多機能なツールとして成熟しつつあります。ただしDSLは今後も改良が続く見込みで、将来的にはグラフィカルI/Oの高度化やタイミング解析、RustやTypeScript以外へのコード生成などの拡充が計画されています。最終目標としては、NCGを使ってカスタムCPU全体を設計し、テキストベースで本格的なハードウェア開発が行えるようにする構想が示されています。
References / 参考リンク
- GitHub - neknaj/circuitgame
- Neknaj Project Website
- NCG Tutorial (Japanese)
- NCG DSL Syntax Highlighting (VSCode)
(English)
If you are interested in text-based circuit design, give Neknaj Circuit Game a try on its GitHub or hosted web playground. Because it’s open-source (MIT license), you can modify, contribute, or integrate it into your own projects.
(Japanese)
テキストベースでの回路設計に興味がある方は、ぜひGitHubリポジトリやWeb版をチェックしてみてください。NCGはオープンソース(MITライセンス)で提供されており、自由に改変やコントリビュート、他のプロジェクトとの連携が可能です。
以上がNeknaj Circuit Gameの概要と特徴でした。ご参考になれば幸いです。