I re-created the game of life in Assembly

  Рет қаралды 21,739

Tom Delalande

Tom Delalande

Күн бұрын

Пікірлер: 124
@JaredFL
@JaredFL 6 ай бұрын
Assembly is high level. If you haven't manually applied electricity to the individual grains of sand, you aren't a senior developer.
@WifeWantsAWizard
@WifeWantsAWizard 6 ай бұрын
Grains of sand are high level. Hey, everyone! Jared doesn't know about robust qubits on super-cooled semiconductor platters. Senior, indeed!
@DiegoGamboa-lo2lw
@DiegoGamboa-lo2lw 5 ай бұрын
This comment shows you are not a senior developer
@tanko.reactions176
@tanko.reactions176 6 ай бұрын
now.. start writing some macros for common coding tasks, like for loops. call it "for".. repeat writing such macros and you will end up with C
@daniel_77.
@daniel_77. 6 ай бұрын
I know this is meant to be a joke comment, but is it accurate?
@jan.tichavsky
@jan.tichavsky 6 ай бұрын
@@daniel_77. Not really. Macros are afaik fixed substition rules, you still end up with straightforward translation to machine code at most with two passes of the file. Now compiling C to machine code is a dynamic process which you can tune and the result depends on context of the rest of your program.
@daniel_77.
@daniel_77. 6 ай бұрын
@@jan.tichavsky is the speed similar?
@neniugrava
@neniugrava 6 ай бұрын
​@@daniel_77. Not even close to accurate. Compilers are typically very complex pieces of software that parse your code and convert it into an intermediate representation (an abstract syntax tree) and then use some fancy algorithms to optimize out redundancies (and more). Then you've got the linker that figures out how to combine all of your files/classes with libraries you use. An assembly macro system is more like the C preprocessor. A few of the assembly statements in this video are macros. it is very unlikely that you'd beat a compiler in speed or code size with hand-written assembly code (compared to a low-level compiled language like C).
@noelgallagher3646
@noelgallagher3646 6 ай бұрын
​@@neniugravaI don't know why people keep repeating this. Handwritten ASM is faster and the binary is smaller. for example, compilers suck at SIMD and intrinsics are ugly as hell to work with. Advantage of higher level languages is portability. No need to write ASM targeting x86, ARM, whatever
@ashutoshj
@ashutoshj 6 ай бұрын
I graduated last year, seems like my CS degree wasn’t just for writing code-it was also my secret decoder ring for getting those cryptic tech stuff. Awesome vid!
@markamber1480
@markamber1480 6 ай бұрын
They teach computer engineering, assembly, etc in CS yes?
@ashutoshj
@ashutoshj 6 ай бұрын
​@@markamber1480 Yes, I had a course on Microprocessors and Microcontrollers where we had to write some programmes in assembly and verilog.
@m33r61
@m33r61 6 ай бұрын
@@markamber1480they teach computer engineering in computer engineering
@אקרמיצאלח
@אקרמיצאלח 6 ай бұрын
Its hard to answer for all universities globally, but in my country at least every university has a couse in which you will learn assembly although its not the main focus of the course​@@markamber1480
@osayemeokwechime2456
@osayemeokwechime2456 6 ай бұрын
@@markamber1480 I was taught computer architecture and assembly in my CS program.
@EdwinMartin
@EdwinMartin 6 ай бұрын
What do you mean there's no "if". A conditional branch instruction in assembler is the same thing but with more words.
@mahakleung6992
@mahakleung6992 6 ай бұрын
As a retired software engineer who grew up in the analog age, I say BRAVO! I always thought OO was way too much abstraction. I have coded in hex embedded processors and worked with data scopes. BTW, you can do assembly directly in C via macros. You can interface assembly into anything using a linker or DLLs. Efficient coding is a long since dead art if you are not doing RTOS like missile guidance.
@iCrimzon
@iCrimzon 6 ай бұрын
Now make a tutorial for a neural network in ASM x86 pls bro
@Takyodor2
@Takyodor2 6 ай бұрын
It's funny because the x86 part is much scarier than the neural network part 😂
@enricofischer1330
@enricofischer1330 6 ай бұрын
​@@Takyodor2 True, one comand compiles to different oppcodes lol
@notsojharedtroll23
@notsojharedtroll23 6 ай бұрын
This, but unironically
@Takyodor2
@Takyodor2 6 ай бұрын
@@notsojharedtroll23 I'm not sure it would be a good idea. Most use-cases for neural networks I can think of involve images (or other complex file types), and I think writing ASM to unpack the training data would be both tedious and hard.
@raphaelfrey9061
@raphaelfrey9061 5 ай бұрын
The only hard thing is keeping track of the loops, activation functions and floating point values.
@Grahamaan27
@Grahamaan27 6 ай бұрын
"to me [classes] just look like meaningless boilerplate" What did you just say?
@friedmule5403
@friedmule5403 6 ай бұрын
LOL, Oh the good old days:-) I have to say that your version of Assembler is a fairly high level, compare to the start 80s. You had no way to just add ASCII, you had to call the letters from the right memory, switch them, combine them and then start up the memory part that had to do with the screen, then set the screen up, tell the CPU to calculate, add the result to the address that you had made for a buffer and send it to the screen.
@igorvasylchenko8293
@igorvasylchenko8293 6 ай бұрын
Python: gets ready working example of Conway's Game of Life with GUI in under 2 min. (including intro) Java: proceeds to write server with single GET endpoint C++: implements custom classes to handle routine file management C: writes text editor in terminal Assembly: spends more than a half of video to write terminal version of Conway's Game of Life (not including off-screen time which I suspect is SLIGHTLY bigger considering debugging mentioned bugs) Classic at its best)
@Slicudis
@Slicudis 6 ай бұрын
I hate x86, ARM and RISC-V so much, leading me to design my own architecture lol (I'm not joking)
@thenameisluk
@thenameisluk 6 ай бұрын
nice video
@cvabds
@cvabds 6 ай бұрын
Can you do that but in TempleOS?
@white_145
@white_145 6 ай бұрын
isnt templeos just funny c?
@denissorn
@denissorn 6 ай бұрын
Java AoT... There are options like GraalVM, but normally you only AoT compile to bytecode.
@naghs2726
@naghs2726 6 ай бұрын
with assembly sometimes it can help to write equivalent C code then paste it into godbolt to see the assembly at different optimization levels and how you might code it in assembly
@uuu12343
@uuu12343 6 ай бұрын
Big OO is a real Pain
@beradeep
@beradeep 6 ай бұрын
Can you please bring a playlist on Kotlin and Htmx?
@mou8842
@mou8842 6 ай бұрын
i really struggled to read the code in the c++ part, guess i'm addicted to colorschemes
@cook5436
@cook5436 2 ай бұрын
Great! Did you use ChatGPT as an aid for the file explorer?
@F100cTomas
@F100cTomas 6 ай бұрын
I don't think your C++ code has any memory leaks. Shared pointers are just really smart. When you copy them a counter goes up and when you destroy them or reassign them the counter goes down. When the last shared pointer stops pointing at that address, the memory gets freed.
@zxuiji
@zxuiji 6 ай бұрын
5:29, The only time you should not be setting up the free() and fclose() call at the end straight away is if you're returning it or passing that responsibility to a specific thread. In all cases you should have a fallback free() and fclose() call.
@brunojcm
@brunojcm 6 ай бұрын
so, you don't use any "heap", just registers and the stack? writing something without heap is pretty cool :)
@tom-delalande
@tom-delalande 6 ай бұрын
I am not ready for the heap yet, but I will try it some day
@batatanna
@batatanna 6 ай бұрын
​@@tom-delalandeOnce you use it you can never go back
@thewholeworldisburningharry123
@thewholeworldisburningharry123 6 ай бұрын
I remember about Low Level Learning video on NASA’s procedure to writing safe code. And the 3rd rule is not using the heap !!
@brunojcm
@brunojcm 6 ай бұрын
@@thewholeworldisburningharry123 keen to what this one :) That's easier on arm, anyway, it seems to have plenty of registers. IIRC from my uni times x86 has AX BX CX DX and that's it.
@jan.tichavsky
@jan.tichavsky 6 ай бұрын
@@brunojcm x86 64 has more, then you can use all the different extensions and multimedia features, boom you have tons of rregisters to use. RISC based CPUs have at least uniform bank of registers which is easier to think about.
@NostraDavid2
@NostraDavid2 6 ай бұрын
I would argue that Haskell is the highest level language there is, since you kinda need to know Category Theory (very abstract math) before you can understand the Monad. But maybe that's just me.
@pdr.
@pdr. 6 ай бұрын
I would agree that Haskell is a very high level language but completely disagree that you need category theory to understand what a monad is in Haskell. By the way, @OP, when did C become a _low-level_ language? Basically, any language above assembler is considered high level.
@pdr.
@pdr. 6 ай бұрын
And to explain why Haskell is very high level, you can think of functional programming as a higher level of discipline. That is, you are more restricted in what you can do. This allows for easier analysis at the cost of being less verbose. Similar to how electrical engineers use discrete components and operate those components under strict conditions, like standardising what high and low voltage signals are which allow you to forget about voltages completely and start talking in 1s and 0s instead.
@vidal9747
@vidal9747 6 ай бұрын
​@@pdr.C is lower level than most. Some people call it middle level even.
@willmungas8964
@willmungas8964 6 ай бұрын
@@vidal9747I think it’s fair to say C is high level from a systems and OS programming perspective, but low level for any kind of application programming. It offers useful abstractions to be just above assembly, but those who are familiar with assembly have a fairly easy time conceptualizing what assembly code will be generated by a given piece of C code because the abstractions are so direct.
@kehindeakiode2865
@kehindeakiode2865 6 ай бұрын
​@@willmungas8964Very true. It was from learning C that I really understood what the processor was doing under the hood.
@ninetydirectory3798
@ninetydirectory3798 6 ай бұрын
Every software is open sauce once learned Assembly.
@tempname8263
@tempname8263 6 ай бұрын
It'd be nice to see how fast can your program execute, it being plain asm with minimal memory access.
@xcoder1122
@xcoder1122 6 ай бұрын
"Assembly is better than Python" - Better at what? I'm pretty sure if you put two random people side by side, person A and person B, you can always say that person A is better than person B because there surely is at least one thing, person A will be better at than person B. But you can say the same for person B, as it surely also works the other way round. So the term "better" on its own is meaningless unless you also name a property that you are comparing.
@pro_gemer
@pro_gemer 6 ай бұрын
Python cccp brainwashing accept assembly as your superior and future manager
@no_nuts0614
@no_nuts0614 6 ай бұрын
it's better at coding
@baraka629
@baraka629 6 ай бұрын
"assembly is better" - 💪😎 "b-b-better at what?" - ☝️🤓💬
@jorgedavid726
@jorgedavid726 6 ай бұрын
Now say it again without criying
@xcoder1122
@xcoder1122 6 ай бұрын
@@jorgedavid726 You seem to have posted to the wrong thread. Your comment doesn't even make sense in this context.
@Cronay
@Cronay 6 ай бұрын
Liked the video! The repository is still private I guess.
@tom-delalande
@tom-delalande 6 ай бұрын
Thanks! I knew I forgot something
@d3adstarr
@d3adstarr 6 ай бұрын
cool video man
@AndrewTSq
@AndrewTSq 6 ай бұрын
Next we do it in Machine Code :) nice one
@timondalton8731
@timondalton8731 6 ай бұрын
Loved slapping HTML/CSS🤣
@replikvltyoutube3727
@replikvltyoutube3727 6 ай бұрын
Now write it in bash
@Somfic
@Somfic 6 ай бұрын
pretty much anything is better than python
@atrbulldog5955
@atrbulldog5955 6 ай бұрын
Everything is better than python, most of its libraries are written in different languages lol
@zill150
@zill150 6 ай бұрын
The fact that people rewrite Python into libraries in different languages only to continue to use Python is pretty telling
@charlieking7600
@charlieking7600 6 ай бұрын
​@@zill150well, some people don't get the concept of scripting language and the fact that not everyone is a professional programmer. Even scientists use Python, because they have already difficult work and low-level programming isn't going to help.
@pubdigitalix
@pubdigitalix 6 ай бұрын
@@charlieking7600 Some people are lazy. Most scientific programs for the 70s was writing in Fortran and most scientists of that time are not professional programmers either.
@Quanayman
@Quanayman 6 ай бұрын
0:28 nothing like RUST.. most loved language XD
@henning4327
@henning4327 2 ай бұрын
Uuhm ... You do know that this still runs on a bloated OS, right? Make it run on bare metal!
@peterwilson7532
@peterwilson7532 6 ай бұрын
Assembler is too high level for me, I prefer to punch in a series of ones and zeros with a handheld switch! Machine Code baby, yeah. 😂 My computer BIOS Bootstrap is made of diodes soldered to a motherboard. You have to get the soldering iron out to edit the code. I spend almost my entire life, programming my computer to add two numbers, outputting the answer on binary coded individual LEDS. It would only take me three months to input the code for ”The Game of Life". Drawing the output to paper for the first move would probably take a day. After three months I could clamp all the drawings along one edge and flick through them quickly, creating the animation of the screen on a regular computer. At 50Hz I would have 2 whole seconds of gameplay after 3 months, so fast, phew!
@whiskerskitten513
@whiskerskitten513 6 ай бұрын
Loved the vid, should try code in Windows batch file since its inbetween c and assembly.
@nou4605
@nou4605 6 ай бұрын
Wut no. Batch scripting is pretty high level. On the same level as Python.
@vidal9747
@vidal9747 6 ай бұрын
7:55 let me tell you how godamn awful Fortran documentation is... Most of it is for stuff that is in the lengugae but is not good practice to use anymore.
@sillybuttons925
@sillybuttons925 6 ай бұрын
Ha, I loved VIN! Looking forward to the release to switch off neovim.
@Progaros
@Progaros 6 ай бұрын
Great comparison!
@xcoder1122
@xcoder1122 6 ай бұрын
It looks like you might have missed it, but Python is an object-oriented language. All data types in Python are actually classes. Even "int" is a class in Python, but "int" isn't a class in C++ or Java. Also, the NoneType is a class in Python, so even the thing that represents no value whatsoever is a class in Python. This means that Python is more object-oriented than C++ and Java, not less. Python is as object-oriented as Smalltalk when it comes to data types. Smalltalk goes one step further by making every instruction a method (even "if" and "while" are not language constructs, they are methods in Smalltalk). So it doesn't make sense to bash on Java and C++ for being object-oriented languages but not on Python. Python's OO approach just makes it seem less OO at first glance. E.g. you may criticize that in Java every function must belong to a class, while in Python you can have functions that don't belong to any class; but the reason for this is that functions are objects themselves in Python, so they don't need to belong to a class, they can exist on their own, but not in Java; Java functions are not objects, so again, Python is way more object oriented than Java.
@Chr0n0s38
@Chr0n0s38 6 ай бұрын
In all fairness with Java, int is a primitive but there is a class wrapper around it. Java doesn't have functions, but rather methods, for exactly the reason you stated. It is fully OO because of that. You never have to use a primitive in your code directly. It's a different approach to implementing OO, that doesn't make it less OO.
@xcoder1122
@xcoder1122 6 ай бұрын
@@Chr0n0s38 "Java doesn't have functions, but rather methods" - Methods are functions. There is no objective distinction between those two terms. In Swift for example. classes also have functions, yet those functions are basically what Java would call methods. Dito Rust. In JavaScript there are only functions, yet JS is an OO language with objects. The original idea of OO did not include methods but "messages". Objects would exchange messages but the concept does not define what a message looks like or how it is implemented. A static method in Java is conceptional no different to a function in C and if you use only static methods in Java and only primitives, you can do functional programming in Java, nobody is stopping you from doing that (just search Google for "functional programming in java" and you will find thousands of code samples). And yes, Java has wrappers, but that's not the point. The point is that it has primitives and that makes it less OO to a language where everything is an object. In Python, everything is an object, because in Python everything must be an object as Python only knows objects, in Java not everything is an object. The fact that you can wrap primitives in objects doesn't change the fact that in Java not all data types are objects.
@Chr0n0s38
@Chr0n0s38 6 ай бұрын
@@xcoder1122 There is a distinction. Functions exist outside classes, methods do not. That distinction does matter when you try to say that the lack of functions as objects makes Java less OO than Python. If anything, the fact Python lets you avoid OO makes it less OO (hence why it is called general purpose and not OO). If you're going to count primitive ints against Java when object wrappers exist, then you should count stand-alone functions against Python. All of this is ultimately purity spiraling though. Python works best when used as a declarative functional language, going against OO. OO is just bad design.
@xcoder1122
@xcoder1122 6 ай бұрын
@@Chr0n0s38 Again, not true for many languages where functions do live within classes or are parts of objects because what Java calls methods is called function in many languages and that is totally okay. Just because Java decided to call their functions methods does not mean that a function that is part of an object or a class must be called method. There is no such rule anywhere in the entire IT industry. When yo make you own programming language tomorrow, you are free to call your functions methods and you methods functions or call both by entirely different names and nobody will forbid you to do that. The term "function" existed in mathematics long before there even used to be programming languages. Swift always calls them functions, whether they are attached to class or not doesn't matter. Javascript always calls them functions, whether they exist standalone or are part of an object. Rust uses functions as a superordinate concept; there are methods and closures and Higher Order Functions (HOF) and Diverging functions, and those are all different types of functions according to the rust manual (so rust even literally says methods *are* functions). There is no rule that a function belonging to a class must be named a method, just because that's how Java names them. And no, Python does not let you avoid OO. You use a data type in Python, you use an object. You cannot write any Python code whatsoever that does not use objects. You seem to be under the incorrect impression that OO means your code must look in a certain way or you must design your code to OO principles. Just because you don't follow OO principles does not mean that you are not using OO. In Python you have no choice, you always use OO. Just because your code doesn't look that way means nothing. Did you perform the Google search I told you? If you did, you had seen plenty of Java Code that also follows no OO principles and does not look like OO code at all. You cannot use Python as a "a declarative functional language" because the moment you use any data type, that is an object and a a declarative functional language has no objects.
@Chr0n0s38
@Chr0n0s38 6 ай бұрын
@@xcoder1122 Again, that distinction does matter. Functions in classes are methods, even in other languages. Now that said, other languages may not choose to follow that distinction for themselves, but it doesn't mean the distinction isn't there. They just choose to ignore it. And yes, Python does let you ignore OO. OO isn't just "everything is an object" it's a programming style. Smalltalk forces, as does Java (seeing as how not even main exists outside of an object). When writing Python code you can choose to ignore that full feature set. I do that all the time, favoring a functional style instead. What the language uses under the hood doesn't matter, if it did then nothing would be OO because under the hood it's all actually procedural. Style is entirely in how you use it. You need to brush up on your vocab, badly.
@sidharthcs2110
@sidharthcs2110 6 ай бұрын
I guess 1s and 0s are even better
@W0lfCL
@W0lfCL 6 ай бұрын
Pfft, Imagine not passing bits to the processor and just lazily coding in assembly
@BinaryMaestro1
@BinaryMaestro1 6 ай бұрын
html and css are not programming languages bros honest at least also why didnt u try zig instead of C?
@willmungas8964
@willmungas8964 6 ай бұрын
Because Zig has barely been around and is relatively unknown, and C is only one of the oldest, most stable, and most well known languages still in use today
@jan.tichavsky
@jan.tichavsky 6 ай бұрын
CSS is complex and offers interactive features, conditions, complex selector options and so on. You can do multi level interactive menu with it as well as actuate stuff with simple checkbox (hide, show, move, etc.).
@zeektm1762
@zeektm1762 6 ай бұрын
@@willmungas8964Fortran
@brunojcm
@brunojcm 6 ай бұрын
I could smell something going wrong when you said shift right... but for some reason XOR came to my mind instead of AND, which is indeed the best option.
@marko9900
@marko9900 6 ай бұрын
Assembly is just a low low level language. You need to go deeper. Machine Code. only 1's and 0's. Its low low low level language :D
@xorxpert
@xorxpert 6 ай бұрын
Java is memory efficient? Haha, consult with the garbage collection department
@accountlinkingmail
@accountlinkingmail 6 ай бұрын
1st
@frytura
@frytura 6 ай бұрын
binary is not a programming language?
@jan.tichavsky
@jan.tichavsky 6 ай бұрын
No, it's a data format.
@Charlyzard_ssb
@Charlyzard_ssb 6 ай бұрын
you smell like a webdev
@xxXXuser69420XXxx
@xxXXuser69420XXxx 6 ай бұрын
bro coded GoL in ASM and that's what you extrapolate? Low T energy frfr
@m4rt_
@m4rt_ 6 ай бұрын
That C code is awful... though I guess it's fine since it gets the job done.
@p99chan99
@p99chan99 6 ай бұрын
Elaborate
Just enough assembly to blow your mind
29:31
Kay Lack
Рет қаралды 155 М.
Why I Use C | Prime Reacts
13:00
ThePrimeTime
Рет қаралды 186 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
Authentication is a developer nightmare
15:58
Tom Delalande
Рет қаралды 61 М.
Python 3.13 vs. Julia 1.11 with Word Frequencies
5:56
EKB PhD
Рет қаралды 1,9 М.
The cloud is over-engineered and overpriced (no music)
14:39
Tom Delalande
Рет қаралды 697 М.
how reverse engineering makes you a better programmer
13:12
Low Level
Рет қаралды 208 М.
10 weird algorithms
9:06
Fireship
Рет қаралды 1,3 МЛН
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 1,4 МЛН
Programming with Math | The Lambda Calculus
21:48
Eyesomorphic
Рет қаралды 247 М.
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 609 М.
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 7 МЛН