HNHacker News
TopNewBestAskShowJobs

sergex

120 karma · joined July 5, 2018

I work on http://nandgame.com
submissionscomments
sergex··on NandGame – Build a computer from scratch
Author here. Yeah, the first level is special and perhaps half-baked. It felt like cheating to start with the NAND-gate as the atomic component since transistors are not NAND-gates. So I start with electric relays (since they logically correspond to transistors but are easier to visualize). But I didn't want to get into realistic simulation of electronic circuits with all the complexity this entails.

May I ask how you would have preferred to solve the first level if the game didn't have limitations?

sergex··on NandGame – Build a computer from scratch
Is your problem with the user interface, i.e. how to connect wires from input to output, or is is with the logical problem of getting the correct output?
sergex··on NandGame – Build a Computer from Scratch
Yes that would be great!
sergex··on NandGame – Build a Computer from Scratch
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.

sergex··on NandGame – Build a Computer from Scratch
No it means you can either optimize for fewest components or fewest nand-gate. The text could be clearer.
sergex··on NandGame – Build a Computer from Scratch
Author here - I would love to do a few layers below the nand gate.
sergex··on NandGame – Build a Computer from Scratch
> I'd like to see the ability to "unbundle" the composite components.

This is a great idea, and you are not the first to suggest it. I just haven't gotten around to implement it.

sergex··on NandGame – Build a Computer from Scratch
Yes it has improved a lot. Still more improvements to come!
sergex··on NandGame – Build a Computer from Scratch
Thank you very much for the suggestions.
sergex··on NandGame – Build a Computer from Scratch
Author here: The reason you drag from the input rather than output is that a pin can have only one input.
sergex··on NandGame – Build a Computer from Scratch
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.

sergex··on NandGame – Build a Computer from Scratch
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.
sergex··on Ask HN: Scalable Hosting for Side Project
It is a web site, but it seems they have a "sites" plan for 5$ a month. Looks great, thanks!
sergex··on From Nand to Tetris: Building a Modern Computer from First Principles
That would be really cool. I need to refactor a bit to allow different translations of the text, but I can get back to you when it is possible.
sergex··on From Nand to Tetris: Building a Modern Computer from First Principles
Code goes into how logic gates like the nand gate are built, so it does start at a lower level than Nand to Tetris which start with nand gates as primitives.
sergex··on From Nand to Tetris: Building a Modern Computer from First Principles
Yeah it currently only compares the solutions towards the minimum number of components of any type. I also intend to compare against the minimum number of nand gates overall, but this is not yet supported.
sergex··on From Nand to Tetris: Building a Modern Computer from First Principles
That would be really cool!
sergex··on From Nand to Tetris: Building a Modern Computer from First Principles
I made a small game inspired by the first lessons in the course: http://nandgame.com/
sergex··on Show HN: Online challenge: Build a CPU from scratch
Thank you for finding the bugs! It shouldn't even be possible feed a 5 to a one-bit connector.

Yes I think I shot myself in the foot by designing the connectors so the labels could only be one or two letters. There is no technical reason they couldn't have descriptive labels like "clock" rather than "c". But it would probably require to turn the design "on the side", so the connectors are left-right rather than top-bottom.

I know I miss tests for a few of the levels.

Thanks for the nice words, it is encouraging!

sergex··on Show HN: Online challenge: Build a CPU from scratch
Actually there was a bug both in the text and in the code. A=1 should be 0x8FE0, but this was not specified correctly. I have fixed it now (I hope).
sergex··on Show HN: Online challenge: Build a CPU from scratch
Thanks, it is a very cool idea. I wanted to make the game really simple and accessible, but there seem to be interest in optimization challenges like finding the smallest/cheapest/fastest possible solution.
sergex··on Show HN: Online challenge: Build a CPU from scratch
You are correct, the text is wrong. It should be 128KB, not 64KB. A word is two bytes (on a 16-bit architecture) so we can address 64K words which is 128KB. (I think you mixed up byte and word in your comment, but I understand what you meant.)

The explanatory text for the level does not really define neither "byte" or "word", so beside fixing the error it also need more details. (But I want to avoid going down the rabbit hole of explaining that bytes can have different sizes than 8 and so on)

sergex··on Show HN: Online challenge: Build a CPU from scratch
May I ask about browser/platform and what you did to make this happen? I am not able to reproduce the issue.
sergex··on Show HN: Online challenge: Build a CPU from scratch
Yeah I'm unsure how to clearly communicate how the connectors work.
sergex··on Show HN: Online challenge: Build a CPU from scratch
Interesting idea, but how should this be determined? Would it be a "cost" per transistor and wirelength, and then the minimum clock cycle time would be the "worst case" path through the circuit?
sergex··on Show HN: Online challenge: Build a CPU from scratch
No, just ignorance on my part. I would be easy to flip input and output though.
sergex··on Show HN: Online challenge: Build a CPU from scratch
Doh, you are correct about selector - the decoder should no be available here (and is not needed). And the bus definitely needs an introduction.
sergex··on Show HN: Online challenge: Build a CPU from scratch
Thanks! A possible solution [spoiler alert!] is inv(add(inv(input), inv(0)) where inv(0) is an inverter without any input.

By the way I suppose the subtraction component should be available in this task. This would make is simpler. I had trouble deciding if increment should be before or after subtraction.

sergex··on Show HN: Online challenge: Build a CPU from scratch
You need to special case "target a", it should be 1 in case bit 15 is 0. The error reporting could definitely be improved. It should probably display the exact mismatch, something like "with input XXX connector Y was 0 but was expected to be 1". Otherwise it gets to tedious to debug.

The m issue is a bug in the spec, thanks for discovering it.

Thank you for the feedback, it is much appreciated.

sergex··on Show HN: Online challenge: Build a CPU from scratch
I would love to be able to get as close as possible to the "feel" of working with actual physical components.
Page 1 of 2Next →