What would be the best way for me to learn coding in computercraft without going to programming collage? How did you all learn?
I'm going to answer by taking the word "computercraft" out of that tuple question. [ but i'll re-insert it later once i've made the point :)/> ]
I've never learnt to code at any college or university… only education in it i got was at high school when i was 14-17. But it was good education, taught from the bottom up, from binary arithmetic and half-adders and
karnaugh maps - so one was taught how to reduce something down to logic.
This was back in the 80s, home computers were only just becoming really popular, I'd been given a Sinclair ZX81 at christmas when I was 13.
… but I learnt to code before that, by reading Popular Computing magazine and similar, they'd have BASIC listings in them to type in… but I didn't have a computer, my mum had brought home the magazines for my elder brother but he wasn't that interested… but I found them fascinating, so I read the descriptions next to the listings, and read the code… and tried to work out what it all must mean.
I still have a pencil written note of one of my first programs - all that it did was animate a block pixel "sprite" of a space-invader type thing, over two frames - using PRINT AT x,y; "#" type commands in a loop… and when I finally got a computer I just played with it, all the time i had spare.
Experimenting with things, seeing if I could break something, and reading more and more of other people's code.
ok Mr Blah Blah, you say… how does this help? well, what I mean is
1. play and experiment - often with no goal other than the experimentation itself… I still do that a lot today - I might right a piece of code just to see if it makes sense, and then go "ok" and never use it, but I'm certain to have learnt something along the way.
2. write pseudo code before you open the terminal - you'll need to do this less and less as you get more proficient, but initially it's good to write down the concept of something as a script just in english [ or your preferred own human language :)/> ]
3. draw pictures… block diagrams, flowcharts - turn your pseudo-code english into more modular stages
this then leads to
4. modularisation + abstraction of code - this is the crux of becoming a coder rather than a "script-kiddie" so to speak, where because of your preparation in organising your concepts into modular blocks, you can then start to see how you can re-use rather than re-type…
those steps are, i'd say, in order of "how deep you are happy to go" - but whatever level you are at - don't be afraid to just type something, and see if it works! - print debugging is your friend if you're not sure whether what you're doing is right… and can help explain the internals if reading other people's pastebinned code… i.e. if you've downloaded some routine someone has written, open it up and add some print(somevariable) lines into it at points where you're not sure what it's doing… even now i often do that and go "oh, i see… that's why it wasn't working" - and it'll be something so obvious once you've printed out one of the intermediate results that
you absolutely totally knew was going to be something else :)/>
… i was going to come back to ComputerCraft wasn't i … yeah, the big bonus with computercraft is that you can do all that, but with much more tangible feedback - i really wish i'd had computercraft when i was learning to code back then, it's just such a joy to write something which makes pistons move and lights turn on [ virtual as they are ].