Live data from Hacker News

NandGame – Build a Computer from Scratch

nandgame.com

131–140 of 141 posts

Re: NandGame – Build a Computer from Scratch

#132
post #92

Building circuits is neat, but I think this has some problems as a game: 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. 2. It's not really clear how NAND gate counts work in later levels where you're using potentially non-optimal components you've built? Like does it count each…

Author here - thank you for the feedback! The nand-count is based on how you built the components involved. So optimizing a component will have have cascading effects. "This is the simplest solution!" means the solution with fewest individual components on the canvas. I realize the text could be clearer.

I see, thanks!

Yeah if you see my comment below I think really it should always be explicit both about whether you used the fewest components and (separately) about whether you used the fewest NAND gates. Currently it seems like you sometimes only get told about one or the other...

Re: NandGame – Build a Computer from Scratch

#133
post #34

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. /sarcasm.parody

Author here - I would love to do a few layers below the nand gate.

Re: NandGame – Build a Computer from Scratch

#134
post #117

This is fun! But, the first few told me "this is the optimal solution", then I hit the xor gate, and I can get either "this uses the fewest nand gates but it can be done with fewer components" or "this uses the fewest components, but it can be done with fewer nand gates".. Does this imply that there is no optimal solution, or just that I've not yet found it?

You haven't yet found the optimal solution. I had the same problem and it wasn't until a later problem that I realised XOR could be implemented with fewer nands.

Re: NandGame – Build a Computer from Scratch

#135
post #133
post #34

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. /sarcasm.parody

Author here - I would love to do a few layers below the nand gate.

"A few layers" - pun intended?

A CMOS game, drawing the various layers that make up transistors, would be interesting to see.

Re: NandGame – Build a Computer from Scratch

#136

I know digital logic, yet was perplexed by the odd definition of D flip-flop this game uses with both "store" and "clock" inputs, which matches none of the standard variants of DFFs: https://en.wikipedia.org/wiki/Flip-flop_(electronics)#D_flip... 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 latch…

Yeah. The flip flop, and its corresponding register version would be a DFF with enable pin. That is not actually too abnormal. The traditional implementation is taking a normal DFF and adding the enable feature either by gating the clock or by adding a mux in the input path, that uses the enable signal to select between the input or the existing output.

Everything started making sense after I thought of "store" as "enable", and I made it to the end pretty quickly after that --- except for the "bonus" multiplier level, which is definitely possible but seems like it would take about 10x as much space as the canvas allows.

Re: NandGame – Build a Computer from Scratch

#137
post #117

This is fun! But, the first few told me "this is the optimal solution", then I hit the xor gate, and I can get either "this uses the fewest nand gates but it can be done with fewer components" or "this uses the fewest components, but it can be done with fewer nand gates".. Does this imply that there is no optimal solution, or just that I've not yet found it?

No it means you can either optimize for fewest components or fewest nand-gate. The text could be clearer.

Re: NandGame – Build a Computer from Scratch

#138
post #91

Earlier quoted context omitted.

Author here - It uses TypeScript and the Angular framework. Not because I prefer Angular in particular but because I had to learn it anyway for a work-related project. I think TypeScript is great.

It looks like it is more canvas than svg, yes? Was there a particular canvas library that you used? I ask because I'm working on a side project that feels like it mostly pulls me in an svg direction, so I'm been prototyping with dagrejs and cytoscape.js, but it also has elements of creating (or dragging, like yours) new elements into a graph and connecting them, so I'm regularly torn when deciding on the basic archit…

I'm not using canvas. SVG is used for the connections, the rest is HTML. I'm not using any particular library for the diagrams, since I couldn't find anything suiting my purpose unfortunately.

I would definitely like to improve the look of the wires.

Re: NandGame – Build a Computer from Scratch

#139
post #92

Earlier quoted context omitted.

Author here - thank you for the feedback! The nand-count is based on how you built the components involved. So optimizing a component will have have cascading effects. "This is the simplest solution!" means the solution with fewest individual components on the canvas. I realize the text could be clearer.

Hi author, cool game, you got me hooked! One thing I could suggest for now (I'm still in the Latch level) is that you could go a bit below and start from the transistor itself, like build the nand gate from the transistors..

Yes that would be great!

Re: NandGame – Build a Computer from Scratch

#140
post #89

What might be some logical next steps to do, learn, or make (preferred) after learning some basic circuit logic?

Building 8 bit computer from scratch? Ben Eater has amazing way to teach and walk you trough it. https://eater.net/8bit

I began this a few years back. Agree with the teaching style, it's amazing. I felt getting a good grasp at the inner workings of some of this chips!
Post reply on HN