• 0 Posts
  • 43 Comments
Joined 6 months ago
cake
Cake day: June 25th, 2024

help-circle






  • Lemme tell you something, DO NOT learn BASIC as your first language. As a hobbyist, I avoided C/C++ for 25 years because I just didn’t get pointers and memory manipulation, and messed around with other languages like JS and PHP instead (also BASIC’s GOTO and GOSUB kinda ruined me as a programmer for a few years). But once it finally clicked a couple years ago, I now want to write EVERYTHING in C/C++.

    I think plain C at least should be everybody’s first language. It literally reprograms your brain to think exactly like how a computer internally functions. I never got that with other languages, because they were so far removed from the actual machine.

    Edit: also, after learning some of it, it’s pretty neat when you do stuff like look at parts of the Linux kernel source code and think “wow, I know what’s actually happening here now!”.




  • I would also go as far as hiding a mini snake game as an easter egg

    If you want some code for that I have my own C++ version I made for an ESP32 with OLED screen, it can easily be adapted to most other languages. I did it to get some programming practice. I have Tetris too. All you gotta do is replace the GPIO button inputs with keyboard inputs (or some other boolean on/off user input element) and replace the graphics framework and routines as well (it’s only simple stuff like lines, boxes, and setting individual pixels). The whole thing runs in a “neverending” while loop, first checking inputs, then checking collisions, then redrawing any objects that need to move to another position.

    I can upload to my GitHub and link them later after work. They do use OOP though, treating each sprite on the board as its own object, and feeding pointers to them into a collision detection routine every game tick. I dunno, some people have a visceral hate for OOP.