Doesn't look like the code is that similar. Doesn't look like copyright has anything to do with it. Does Endoh have a patent? That would of course be a different matter.
aside from the implementation being completely different and therefore not in violation of copyright, it would be difficult to give credit for something like this where every character is strategically placed.
Go to the Sources tab and click the || button to pause javascript. If you're wondering where the code is, just curl the URL :) (or, with Web Inspector open, refresh the page, go to the Network tab and select the only request.
If you look closely you'll see that there's a parallax effect, where the lines near the equator move faster than the lines at the top, giving it a sense of depth and motion that you wouldn't expect from any ASCII art animation.
Reminds me of the episode of the Daily Show where Neil deGrasse Tyson informs Jon Stewart that the Earth is spinning in the wrong direction in the opening credits of the show
Almost any kind of rotation in 2D or 3D graphics involves cos or sin. The spinning was going the wrong way, therefore the way to reverse it was to reverse something involving cos or sin. You can then just bruteforce it by reversing each cos until you get the effect you want. (If reversing cos seems to reverse something "perpendicular" to what you want, then you'd need to reverse the sin instead, not the cos.)
This is true in almost any context involving 2D/3D graphics, not just for this particular example. It's much more efficient than trying to sit there and think through the math or figure out what does what. But of course you learn less that way, so it's a tradeoff. And sometimes it's less efficient if there are too many combinations to efficiently bruteforce, or if it takes too long to test each iteration. But we live in the age of rapid-iteration javascript.
I'd also note that in a point on the unit circle, cosine is the x coordinate and sine is the y coordinate. A good reason to try flipping a cosine first. See this: http://en.wikipedia.org/wiki/File:Unit_circle.svg
(I still remember how people would describe trig in high school, it is a wonder more teachers didn't explain the cos = x, sin = y thing. Probably because my teachers did not understand math.)
I don't think its that easy, it depends more on the specific school and most of all on the teacher. For the record: I also had to memorize it and i went to an "european" school, or rather to an austrian one. Europe still has a wide variety of education systems.
My experience with math education in the US is that they approach it as unapproachable. It is supposed to be some sort of magic, that only limited practitioners may understand, and even then only after an incredibly slow introduction. People teaching it are usually unqualified. Then if you're like me, when you get to college you get exposed to a lot better, then you wonder what those k-12 people were thinking. But a lot of people don't make it that far, because their earlier experience makes them think math is uninteresting or they'll never be any good at it.
Note that my experience involved going to a supposedly "good" school district. There is the entirely unrelated problem of schools varying in quality based on where you live.
My highschool teachers didn't (European school, too). I found it by myself one or two years later (I hated trig in the meantime) and was very proud of my achievement. Then I went to university where all the teachers were treating it like a natural thing, and that was my first glimpse of adulthood -- I started realizing I was really stupid.
While rotation spoils an inertial reference frame, this certainly could be a representation of the view of the earth while from a typical (i.e. easterly) orbit. Short of adding an ASCII accelerometer or the like, there's no test you can do on it to demonstrate otherwise. The GP doesn't deserve downvotes any more than the other glib replies above.
Damnit, it's fixed. I was freaking out that I had it wrong all along and then after rotating my fist a couple of time I was still damn certain it's moving correct. Parent should probably edit the comment that it has now been fixed.
Why do we keep calling it "typical negative nitpicking"? How about calling it "feedback"? Or maybe even "the most useful type of feedback"?
We're encouraged here to post things that add value. But that pretty much implies either criticism or going off-topic ("hey, I've seen something similar here:", etc.). There is no practical value in "positive" comments, no matter how elaborately you can write "I liked it". Yes, it will make everyone feel a little bit better, but it hardly contributes anything of value to anyone.
Not every criticism is a valuable feedback, but every valuable feedback is a kind of criticism. And I think the best thing about HN is that it has lots of civil nitpicking (usually followed by interesting discussions), instead of circle jerks and compliments.
ETA
> Why HN? Why?! There must be a better way!
There is: it's to stop taking criticism so personally and instead extract as much value from it as one can, and discard the rest. I find it to be a good attitude for life in general, not just HN.
I agree with much of what you said - there is significant value in negative feedback.
But here is where I disagree:
>... but it hardly contributes anything of value to anyone...
>... every valuable feedback is a kind of criticism...
Valuable feedback includes positive as well as negative. Negative is actionable feedback, but positive has just as much value in a different way.
Most people are aware that their own perceptions, thoughts, and ideas may be flawed. Negative feedback points out those flaws and should always be accepted. Positive feedback says that in spite of the flaws, there is something fundamentally worthwhile there.
And while upvotes can certainly serve as a form of positive feedback, words are even better.
I'm not suggesting that we should all post meaningless words of encouragement to everything that comes along. But if you're impressed by something you see, saying so only helps.
> Negative is actionable feedback, but positive has just as much value in a different way.
I guess "actionable feedback" was the phrase I was looking for.
> I'm not suggesting that we should all post meaningless words of encouragement to everything that comes along. But if you're impressed by something you see, saying so only helps.
Agree 100%. It's always nice and reassuring to get some positive feedback :).
Truly valuable "feedback" would be a discussion of the actual code used to create this. That's a far cry from the easy, low-hanging fruit of "it's spinning the wrong way". Totally missing the forest for the trees.
Reminds me of the old 1992 winner of the IOCCC by Brian Westley (who consistently entered some of the most impressive programs in that contest). It doesn't spin, but it prints a map of the provided lat/long.
main(l
,a,n,d)char**a;{
for(d=atoi(a[1])/10*80-
atoi(a[2])/5-596;n="@NKA\
CLCCGZAAQBEAADAFaISADJABBA^\
SNLGAQABDAXIMBAACTBATAHDBAN\
ZcEMMCCCCAAhEIJFAEAAABAfHJE\
TBdFLDAANEfDNBPHdBcBBBEA_AL\
H E L L O, W O R L D! "
[l++-3];)for(;n-->64;)
putchar(!d+++33^
l&1);}
There's a lot of talk about scalable code floating around, but it's rare to see anything as scalable as this code. Do you want more precision in your pi approximation? Then you literally scale the code up. There's few people who can truly claim to have written scalable code like that.
Speaking of "scalable code", there is another interesting obfuscated piece of code that can scale itself. akari.c[1] is an obfuscated ASCII art downsampler.
The neat thing is that the program itself is ASCII art, and downscaling the program source code will generate valid programs for 3 iterations![2]
That was a wonderful experience of multiple moments of realization. "Oh, it's an ascii globe; it looks like it just scrolls a map through the circle. No wait, it's warping as it shifts across. Wait, is it using asterisks for antialiasing? What is all of this stuff around the outsi- ... oh. Oh."
Amazing stuff. One quibble; There's a XXXXX in the middle of the South Pacific, midway between Australia and Chile. Whatever it is supposed to be, it's way too big.
What I'd love to see is a step by step description of how this was constructed. If I have an end goal in mind, it's simple enough to hammer some characters into something a machine can use to do that end goal while still being readable by a human. But this? It floors me, and I can't even imagine where to start. I can understand the code with a bit of thought, but getting from an empty text editor to that seems beyond me.
First, you would create some strings approximately representing latitudes on Earth and their associated land masses -- one string for maybe 10-20 degrees of latitude, from some southerly latitude to a northerly one.
Nest, you would figure out a way to print substrings of the strings, at specific points within the strings that you would choose.
Next, you would arrange that the substring printer would wrap around to the beginning of the string in the event that it was asked to print a greater length than the remaining characters available from the specific starting point to the end. By wrapping around, you create the illusion of a circle of characters, like on a globe.
Next, you would think of a way to write into a specially formatted executable text file having a roughly circular central section that is commented out, i.e. not executable.
Next, you would arrange that the specially formatted text file be the running program, and the central comment area represent the display of the earth.
Next, just to blow minds, you would print the current form of the program text file on the console, after each animation cycle filled the comment area.
Finally, you would create the illusion that the earth is rotating clockwise as seen from the north pole (the opposite of reality) just to provoke people who know a bit of astronomy.
101 comments
[ 3.5 ms ] story [ 152 ms ] threadThe author of this one apparently forgot to give credit.
This was brilliant, just absolutely fantastic.
https://news.ycombinator.com/formatdoc
http://www.youtube.com/watch?v=oy3PgFhIpyM#t=0m56s
Happy?
This is true in almost any context involving 2D/3D graphics, not just for this particular example. It's much more efficient than trying to sit there and think through the math or figure out what does what. But of course you learn less that way, so it's a tradeoff. And sometimes it's less efficient if there are too many combinations to efficiently bruteforce, or if it takes too long to test each iteration. But we live in the age of rapid-iteration javascript.
(I still remember how people would describe trig in high school, it is a wonder more teachers didn't explain the cos = x, sin = y thing. Probably because my teachers did not understand math.)
Heh. Yeah, that matters.
In my experience, US highschools are very much "Okay class, today we're going to memorize these formulas."
One of them explained the x/y thing, another didn't.
We went through the unit circle derivation in the 8th grade and were thus showed why cos is conventionally x and sin conventionally y.
Note that my experience involved going to a supposedly "good" school district. There is the entirely unrelated problem of schools varying in quality based on where you live.
... and the top comment is typical negative nitpicking!
Why HN? Why?! There must be a better way!
We're encouraged here to post things that add value. But that pretty much implies either criticism or going off-topic ("hey, I've seen something similar here:", etc.). There is no practical value in "positive" comments, no matter how elaborately you can write "I liked it". Yes, it will make everyone feel a little bit better, but it hardly contributes anything of value to anyone.
Not every criticism is a valuable feedback, but every valuable feedback is a kind of criticism. And I think the best thing about HN is that it has lots of civil nitpicking (usually followed by interesting discussions), instead of circle jerks and compliments.
ETA
> Why HN? Why?! There must be a better way!
There is: it's to stop taking criticism so personally and instead extract as much value from it as one can, and discard the rest. I find it to be a good attitude for life in general, not just HN.
But here is where I disagree:
>... but it hardly contributes anything of value to anyone...
>... every valuable feedback is a kind of criticism...
Valuable feedback includes positive as well as negative. Negative is actionable feedback, but positive has just as much value in a different way.
Most people are aware that their own perceptions, thoughts, and ideas may be flawed. Negative feedback points out those flaws and should always be accepted. Positive feedback says that in spite of the flaws, there is something fundamentally worthwhile there.
And while upvotes can certainly serve as a form of positive feedback, words are even better.
I'm not suggesting that we should all post meaningless words of encouragement to everything that comes along. But if you're impressed by something you see, saying so only helps.
I guess "actionable feedback" was the phrase I was looking for.
> I'm not suggesting that we should all post meaningless words of encouragement to everything that comes along. But if you're impressed by something you see, saying so only helps.
Agree 100%. It's always nice and reassuring to get some positive feedback :).
It's an astonishingly clever piece of self-reproducing code. Did you miss the code and think it was just a crappy animation of the earth?
http://www.ioccc.org/1992/westley.hint
The neat thing is that the program itself is ASCII art, and downscaling the program source code will generate valid programs for 3 iterations![2]
[1] http://www.ioccc.org/2011/akari/akari.c [2] http://www.ioccc.org/2011/akari/hint.html
http://pastebin.com/uUvDGzrb
(note that it will not work like the original and make a pretty globe, because it's dependent on the exact character positioning)
What I'd love to see is a step by step description of how this was constructed. If I have an end goal in mind, it's simple enough to hammer some characters into something a machine can use to do that end goal while still being readable by a human. But this? It floors me, and I can't even imagine where to start. I can understand the code with a bit of thought, but getting from an empty text editor to that seems beyond me.
I hear there will be video in a couple weeks.
Then I viewed the source. Amazing.
More on quines: http://en.wikipedia.org/wiki/Quine_(computing)
I understand that the whole thing is actual source and its manipulating the center commented area. But I am having trouble following the code.
Imagine that you had to write it yourself.
First, you would create some strings approximately representing latitudes on Earth and their associated land masses -- one string for maybe 10-20 degrees of latitude, from some southerly latitude to a northerly one.
Nest, you would figure out a way to print substrings of the strings, at specific points within the strings that you would choose.
Next, you would arrange that the substring printer would wrap around to the beginning of the string in the event that it was asked to print a greater length than the remaining characters available from the specific starting point to the end. By wrapping around, you create the illusion of a circle of characters, like on a globe.
Next, you would think of a way to write into a specially formatted executable text file having a roughly circular central section that is commented out, i.e. not executable.
Next, you would arrange that the specially formatted text file be the running program, and the central comment area represent the display of the earth.
Next, just to blow minds, you would print the current form of the program text file on the console, after each animation cycle filled the comment area.
Finally, you would create the illusion that the earth is rotating clockwise as seen from the north pole (the opposite of reality) just to provoke people who know a bit of astronomy.