2048 implemented in 487 bytes of C
gist.github.com
gist.github.com
'stty' is not recognized as an internal or external command, operable program or batch file.
I would love to read comments instead of downvotes. Where am I wrong?
That part of the comment only is partially correct, and not was even the main point of my comment; what I really meant was that it doesn't belong in windows, and the main point was that the code is not portable.
Coincidentally, a sector on optical media is typically 2048 bytes.
puts(W&1?"WIN":"LOSE");
Shouldn't exit(W&1); be "good enough" while saving some bytes? gcc -o 2048 2048.c
Ignore all the warnings.http://stackoverflow.com/questions/19535422/os-x-10-9-gcc-li...
How many bytes would it take to code it in C in a human readable fashion? Such that some other programmer could look at it, understand it, modify it, fix bugs, etc?
Is the savings in bytes going from the latter case to the former case really an issue in 2014, and does it outweigh the downside (which I think is enormous) of generating obfuscated code?
Having said all that, as an exercise purely in "how small can by code be, regardless of how obfuscated I make it", I suppose it is ... interesting?
but even still I have to admit I don't get the appeal
I find that reading minified/obfuscated code really helps with spotting syntax errors and related subtle bugs in regularly formatted code. Instead of relying on cues like indentation, you begin to parse more like a compiler, and things like missing semicolons stand out.
Take for example the Kinetis KL02 ( http://www.engadget.com/2014/02/25/freescale-kinetis-kl03/ ). With only 32KB of storage and 4KB of RAM, writing efficient code with a small footprint is important. These microprocessors can be used to make swarms of autonomous fly sized drones, and programmers that can cram more procedures into those 32KB are extremely rare and useful.
Trying to write as little source code as possible also leads to trying to find the simplest, most concise algorithm to do a particular task, and that also has effects on the binary size.
Algorithms is an interesting case since you have to ask if you are optimizing for size or speed, as an example you can implement a linear search in fewer lines of code than binary search. Does that mean that linear search is a better more optimized choice. It does if you are optimizing for small executable binary size.
Checkout the demoscene stuff and superpacking JS.