Live data from Hacker News

Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

bitbucket.org

61–70 of 304 posts

Re: Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

#61
post #51

Earlier quoted context omitted.

The fact that it's dead simple is the point of the recommendation. It gives an opportunity to learn the tool with the bare minimum of moving parts involved.

I'd prefer that we unlearn many of these things instead.

Unfortunately, my stock of browser-maintainer mind control rays has run out, so until somebody scrounges one up we'll still need ways to make the web half of the JS equation at least vaguely maintainable.

Re: Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

#62
post #58

Hey looks good :)! Just a few things you might not know about: Google String.prototype.padEnd. It’s built in to JS and should be able to replace your zero fill function. And instead of mutating the ruleSet array you should be able to use Array.prototype.map like this: const ruleSet = zeroFill(8, rules.toString(2)) .split('') .reverse() .map(item => parseInt(item, 10)); And you can clone arrays like this, instead of u…

Though, keep in mind that some of this stuff (most notably the [...arr] syntax) won't work in old browsers if you make a web project (IE 11 is a big offender here). See https://caniuse.com/ for a useful source of info on what will work with what for stuff like that.

If you do web stuff (and you don't want to just say "no IE 11" - some people, and even some big companies, do that!), usually the easiest way to handle stuff like that is to use the newest syntax you're comfortable with, plus a tool like Babel that will produce a "time travel" version with older syntax that will work in all browsers.

Re: Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

#63
post #57

This is awesome liam. im just over twice your age and am just now writing game of life simulators.... man, what was i doing at 12???

Trust me, there can be downsides to starting early. In my case, I virtually skipped having social interactions not on the internet until I was around 20 or so. Not everyone will have this kind of affliction, but you can't have it all - you gotta choose what's important to you. I hope this doesn't come off as being too negative, I mostly say this because I think you should try to appreciate what you did learn rather t…

Oh definitely I agree. Gotta find that middle path.

Re: Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

#64
post #39

It's amazing that at the same age Steven Wolfram himself had written his first 100 page book "concise directory of physics) and at just one year older wrote his first book on quantum physics.

I first thought this was a joke, but he did indeed.

"At the age of 12, he wrote a dictionary on physics. By 13 or 14, he had written three books on particle physics. They have not been published." https://en.wikipedia.org/wiki/Stephen_Wolfram#Early_life

Re: Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

#65
post #3
post #2

All your work is in 1 commit and you only have 3 total commits in your repo. I'm skeptical that YOU wrote this program. I'd happily be proven wrong.

This comment violates HN's rules. Please assume good faith and don't attack people. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/showhn.html Consider the ridiculous downside of someone being 12, posting their program to HN, and meeting with this as a first comment. How awful.

Guys, I think you should ALL calm down and stop playing SJW. He simply stated that he doubts the kid wrote the code. Since when having a doubt is considered BULLYING??? Did he insulted the kid? Did he used a slur against him? No. He expressed his legit and reasonable doubt.

So please turn on your neurons and stop playing mother hen and SJW ok?

Being skeptical is a right we all have to take advantage of and since it has been made in a respectful way, there are no reasons why attacking the user in the way you all did.

This politically correct thing is slipping thru your fingers and out of your control of you REALLY and SERIOUSLY think that expressing a legit doubt is considered an act of bullying. Ponder about that.

Re: Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

#66

Good work. For a next step, I would suggest giving a try at breaking it up into multiple files using import/export statements (it doesn't need it but it's good practice), and using a bundler like Parcel to build the finished file. npm i --save-dev parcel-bundler ...then move your source JS files to a folder named src, and add to package.json... "scripts": { "prepare": "parcel --target node src/index.js" "start": " no…

How about we let the kid learn how to program (which will outlive your favorite bundler and file hierarchy anyway) first? It's a 100 line script, one of the mistakes I made learning how to program was trying to be like the adults and focusing on minutiae like code organization rather than good code. EDIT: story time. I once tried to make a 2D game engine in my late teens, but I wanted to be like the adults and have a…

My intent is less "code structure", and more "most of the pieces you need to make a Node project also work in the browser". Imports/exports and Parcel would get liamilan most of the way towards being able to do...

   if (window) {
     document.write(...)
   } else {
     console.log(..)
   }
...and have it just work, without having to write everything twice.

Re: Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

#67
post #25

I feel bad for all the other 12 year olds whose parents just saw this :)

It's great to be writing code at 12 if you want to write code, and clearly this kid has a talent for it, but that doesn't detract from what all the other 12 year olds are doing. So long as they're happy and safe to do what they want to do it's all good. Growing up is not a competition.

Also, while it may seem great to learn early, I've worked with people who didn't write a line of code until they were in their 50s and they were far better at it after a few years than I am despite having 20 years more experience. Some people have a gift. Others have to really work at it. Sadly I'm in the second group. :)

Re: Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

#68
post #58

Hey looks good :)! Just a few things you might not know about: Google String.prototype.padEnd. It’s built in to JS and should be able to replace your zero fill function. And instead of mutating the ruleSet array you should be able to use Array.prototype.map like this: const ruleSet = zeroFill(8, rules.toString(2)) .split('') .reverse() .map(item => parseInt(item, 10)); And you can clone arrays like this, instead of u…

Good tips if you want your code to fail randomly on older devices.

Re: Show HN: I'm 12, learning JS, and wrote Wolfram's cellular automaton in Node

#70
post #58

Hey looks good :)! Just a few things you might not know about: Google String.prototype.padEnd. It’s built in to JS and should be able to replace your zero fill function. And instead of mutating the ruleSet array you should be able to use Array.prototype.map like this: const ruleSet = zeroFill(8, rules.toString(2)) .split('') .reverse() .map(item => parseInt(item, 10)); And you can clone arrays like this, instead of u…

I think it is good he's learning to do the loops by hand first. It's good to have an understanding of algorithms first when learning to code.
Post reply on HN