TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

NandGame – Build a Computer from Scratch

627 点作者 dalemyers超过 4 年前

43 条评论

carls超过 4 年前
I&#x27;ve done the Coursera course, Nand2Tetris, that inspired this website [1] and found it deeply intellectually satisfying and engaging.<p>If anyone is interested in learning about the logical primitives that build up to a computer, and how they&#x27;re implemented using logic gates, I would deeply recommend the course!<p>-----------<p>[1] <a href="https:&#x2F;&#x2F;www.nand2tetris.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.nand2tetris.org&#x2F;</a>
评论 #25285161 未加载
评论 #25283260 未加载
评论 #25285782 未加载
评论 #25284658 未加载
评论 #25283481 未加载
Sniffnoy超过 4 年前
Building circuits is neat, but I think this has some problems as a game:<p>1. It seems to only let you save one solution for each level, even though there are two optimization goals. It should let you save one for fewest components and one for fewest NAND gates.<p>2. It&#x27;s not really clear how NAND gate counts work in later levels where you&#x27;re using potentially non-optimal components you&#x27;ve built? Like does it count each one as the number of gates that you used, or the number of gates that is optimal, or what? Someone else told me it was the latter, but it seems like XOR counts as 6 even though there&#x27;s apparently a way to do it with fewer?<p>3. Why do some levels give me the message &quot;This is optimal!&quot; while others say &quot;This is the simplest solution!&quot;? What&#x27;s going on here? What do these messages mean specifically? It&#x27;s not clear.<p>All this adds up making attempts at optimization a bit frustrating and as such I just don&#x27;t really want to play it very far. If you&#x27;re not worried about optimization it seems fine, but if you are the interface really kind of works against you.
评论 #25287049 未加载
评论 #25287806 未加载
评论 #25284319 未加载
kayson超过 4 年前
Not that this will ever matter for someone who isn&#x27;t a circuit designer, but the &quot;optimal&quot; solution for the latch is actually really bad.<p>If you use a &quot;select&quot; block (which should really be called &quot;mux&quot;) and tie the output to the input, you create a race condition. If the data input is 1, and you change set from 1 to 0, the output can actually glitch to 0 for a very short period of time, which is a big no-no. (If you draw the equivalent circuit out with just nand gates and assume they all have some delay between input and output, you&#x27;ll see why).<p>A safer solution would be to cross couple two nand gates into an SR latch [0], use another two nand gates to control the Set and Reset signals, and an inverter to create NOT(data).<p>Of course in reality, a latch is usually custom built out of transistors rather than logic gates, but there are some cases where I&#x27;ve used logic-gate-latches to make things easier.<p>&lt;&#x2F;pedanticism&gt;<p>[0] <a href="http:&#x2F;&#x2F;electronics-course.com&#x2F;sr-nand-latch" rel="nofollow">http:&#x2F;&#x2F;electronics-course.com&#x2F;sr-nand-latch</a>
评论 #25293010 未加载
评论 #25285785 未加载
IIAOPSW超过 4 年前
There was this ancient Flash game called &quot;Engineer of the People&quot; that was all about designing IC circuits (NPN and PNP junctions) in the Soviet Union for some secretive reason. I never beat the game and got to the reveal. IIRC it was by Zachtronics, the same guy that did Shenzhen I&#x2F;O and infiniminer (the inspiration for Minecraft).
评论 #25286701 未加载
评论 #25284099 未加载
评论 #25283803 未加载
评论 #25282981 未加载
评论 #25283319 未加载
userbinator超过 4 年前
I know digital logic, yet was perplexed by the odd definition of D flip-flop this game uses with both &quot;store&quot; and &quot;clock&quot; inputs, which matches none of the standard variants of DFFs: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Flip-flop_(electronics)#D_flip-flop" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Flip-flop_(electronics)#D_flip...</a><p>Edit: this continues on with the counter level, where you can use the register but it does not behave like the typical set of edge-triggered flip-flops (or transparent latches) that one would normally use. My best attempt at coming up with an explanation is that it&#x27;s like two-phase edge-triggered logic.
评论 #25293167 未加载
ElHacker超过 4 年前
I got excited when I saw the title, then checked the URL and it is a software simulation &#x2F; game of building a computer. I&#x27;m not denying this can be interesting, but I&#x27;ve been thinking for a while to get my hands dirty with hardware as a side project. (I&#x27;m a software eng by profession). I haven&#x27;t really done a lot of research on this yet, but does anyone have any recommended guides&#x2F;books&#x2F;tutorials on how to get started designing and building my own computer? (extra points it it&#x27;s a mobile&#x2F;embedded computer)
评论 #25283568 未加载
评论 #25283536 未加载
评论 #25284570 未加载
评论 #25284228 未加载
评论 #25283826 未加载
评论 #25283574 未加载
评论 #25283838 未加载
评论 #25283875 未加载
评论 #25284150 未加载
rkagerer超过 4 年前
Neat! My only complaint is I feel like it would be more intuitive to be able to drag connections from output to input. I understand why it&#x27;s the other way around (each input can only have one source, while outputs can go to multiple chips) but it still feels backwards - like reading right to left.
iKlsR超过 4 年前
If you like this or want to get into it a bit more, this recent video is lovely <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=QZwneRb-zqA" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=QZwneRb-zqA</a>
bstrong超过 4 年前
Very cool! Reminds me of all the fun I had with Rocky&#x27;s Boots on Apple II:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Rocky%27s_Boots" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Rocky%27s_Boots</a>
评论 #25283397 未加载
linkdd超过 4 年前
This looks a bit like MHRD [1] but with a GUI :)<p>----<p>[1] <a href="https:&#x2F;&#x2F;store.steampowered.com&#x2F;app&#x2F;576030&#x2F;MHRD&#x2F;" rel="nofollow">https:&#x2F;&#x2F;store.steampowered.com&#x2F;app&#x2F;576030&#x2F;MHRD&#x2F;</a>
评论 #25283887 未加载
评论 #25287753 未加载
evangow超过 4 年前
Awesome! I&#x27;ve always thought it would be interesting to port Nand2Tetris to the web to make it more easily accessible. Glad someone finally ported the virtual computer building part!
herghost超过 4 年前
I was able to get as far as building the half-adder, but then didn&#x27;t have the means of figuring out the full adder as that seemed massively more complex.
mkl95超过 4 年前
I have fond memories from reading this book and doing the exercises. I never got past building RAM memory though :-)<p>It&#x27;s worth mentioning that the book is getting a extensively revised (sic) 2nd edition in July 2021.<p>* <a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;Elements-Computing-Systems-second-Principles&#x2F;dp&#x2F;0262539802" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;Elements-Computing-Systems-second-Pri...</a>
Koshkin超过 4 年前
I find using an FPGA for this an ideal middle point. Building a functional computer from discrete components is fun but the result may not be worth the effort, to be honest. At the other extreme, modeling it in software may leave a weird feeling of not having achieved anything. With an FPGA, on the other hand, you can create something of a usable computer, even one you could run Linux on.
noncoml超过 4 年前
There are 10 kind of people. Those who like to drag from the input back to the output and those who prefer to drag from the output to the input.
评论 #25287355 未加载
radicalriddler超过 4 年前
I did logic gates as part one of my first uni courses in I.T. The assignment was actually so fun, I hated when I finished it.
yellowapple超过 4 年前
So I&#x27;m a bit confused with how this is measuring the number of NANDs; for example, with the first adder problem, I solved it with exactly two gates, neither of which were NAND, and yet while it&#x27;s recognized as the lowest number of gates, it insists that it can be done with fewer NANDs (than zero, apparently). Is it counting the NANDs that may or may not be used to implement those two gates? And if so, is that based on how I solved the previous problems? Or is it based on the lowest possible number of NANDs that would be required to solve those problems &#x2F; produce those gates?<p>If it is indeed counting the NANDs used to make the gates I actually used, it&#x27;d be useful to have a clear indication of exactly how many NANDs each gate uses so I can chase after a game of NAND Golf.<p>In any case, this is fun :)
评论 #25286367 未加载
ducktective超过 4 年前
For anyone interested, also check out this computer designed in Powder Toy game! <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=h4eHgnLFk9k" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=h4eHgnLFk9k</a>
AQXt超过 4 年前
That&#x27;s the coolest thing I have seen today. Thanks! :)<p>Suggestion: replace the blue button text (&quot;I have completed the level&quot;) with something simpler, like &quot;Run&quot;, &quot;Check&quot;, &quot;Test&quot; or &quot;Go&quot;.
simonbarker87超过 4 年前
Some of my favourite courses of undergrad were Digital Electronics 1 and 2. How you can build everything up from nand gates is so satisfying, I’ve forgotten much of it now but this is bookmarked to come back to for posterity
h_anna_h超过 4 年前
The test in the opcodes level is incomplete as for X-Y it accepts ~(X&amp;Y)
ColinWright超过 4 年前
It probably sounds petty, but I found it disturbing that inputs are at the bottom ... I was constantly having to readjust my thinking, and have become sufficiently frustrated to give up.
dusted超过 4 年前
This is fun! But, the first few told me &quot;this is the optimal solution&quot;, then I hit the xor gate, and I can get either &quot;this uses the fewest nand gates but it can be done with fewer components&quot; or &quot;this uses the fewest components, but it can be done with fewer nand gates&quot;.. Does this imply that there is no optimal solution, or just that I&#x27;ve not yet found it?
评论 #25296751 未加载
评论 #25301664 未加载
gdcohen超过 4 年前
This is really cool. You&#x27;ve done a tremendous job in making this very usable (I love your yellow sticky note instructions).
vishnuharidas超过 4 年前
Reminds me of Ben Eater&#x27;s Youtube videos where he builds everything using basic gates on a breadboard. He made a video-card using ICs on a breadboard that fascinated me: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=l7rce6IQDWs" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=l7rce6IQDWs</a>
jzer0cool超过 4 年前
What might be some logical next steps to do, learn, or make (preferred) after learning some basic circuit logic?
评论 #25286537 未加载
Hitton超过 4 年前
I love this game. And was the UI improved since the last time it was posted on HN or am I misremembering it?
评论 #25288019 未加载
pteraspidomorph超过 4 年前
This isn&#x27;t working very well for me on firefox. The components don&#x27;t seem to want to be dragged.
rzach超过 4 年前
Love this - I actually started implementing these circuits in C [0] a while back but never got past combined memory.<p>[0]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23672470" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23672470</a>
BitwiseFool超过 4 年前
This was so much fun! It brings me back to my first class in digial logic.
mathattack超过 4 年前
I used this with several elementary school kids who enjoyed it very much.
wolfgke超过 4 年前
A quite similar game in Steam:<p>MHRD<p><a href="https:&#x2F;&#x2F;store.steampowered.com&#x2F;app&#x2F;576030&#x2F;MHRD&#x2F;" rel="nofollow">https:&#x2F;&#x2F;store.steampowered.com&#x2F;app&#x2F;576030&#x2F;MHRD&#x2F;</a>
newman8r超过 4 年前
this is fun. When I got to the multi-bit-adder I think the half adder was removed from the toolbox though and replaced with the full adder - would be nice to keep it there.
zug_zug超过 4 年前
There&#x27;s a very similar game(text-based) called MHRD
tunesmith超过 4 年前
Nicely done! If the author is reading, care to share any details on what stack or libraries were used?
评论 #25286906 未加载
mikewarot超过 4 年前
That was a fun diversion, thanks!
signaru超过 4 年前
it would be cool (ambitious) if at some point there is also a programming language&#x2F;compiler down the line. perhaps it can would also be able to run tetris or even another nandgame.
berkserbet超过 4 年前
Really cool, curious to see how hard it gets. Reminds me of college.
评论 #25285473 未加载
评论 #25282994 未加载
hnick超过 4 年前
Thank you for showing me how much I have forgotten in 15 years :)
DNied超过 4 年前
I wish Pure Data had a GUI like that. Hats off to the author.
mtoner23超过 4 年前
I&#x27;m a simple man. i see NandGame i upvote
blackrock超过 4 年前
I wonder when we can start 3D printing our own resistors and transistors.
评论 #25282765 未加载
评论 #25282703 未加载
评论 #25287954 未加载
评论 #25283565 未加载
评论 #25284057 未加载
LeonB超过 4 年前
Should start from physics building up and up until you have subatomic particles, rising through many layers of abstraction until you are doping P and N type semiconductors .... starting with such a high level concept as “nand gates” is far too easy. &#x2F;sarcasm.parody
评论 #25283664 未加载
评论 #25289054 未加载
评论 #25285563 未加载
评论 #25289024 未加载
评论 #25296512 未加载
评论 #25289021 未加载