The Infinite Zenith

Where insights on anime, games, academia and life dare to converge

Nagato Yuki and the C Programming Language

Developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs, the C programming language is one of the most widely used programming languages. As a procedural language, it is capable of low-level access to memory, as well as mapping constructs to machine instructions, minimising the amount of run-time support needed. However, it is also a capable language for cross-platform programming. When I stumbled across a TVTropes article proudly proclaiming that some fan had reconstructed the entire program Nagato Yuki had written in the episode The Day of Sagittarius, I decided to go in and check for myself as to what was going on. Having taken a sufficient number of programming courses requiring C and C-like languages, as well as the fact that my research project involves the Objective C language, I wished to verify that such an individual had actually gone ahead and compiled Nagato’s code. Not 10 seconds on Google passed, and I had realised that no such individual had actually gone on and carried out these tests, and moreover, such tests simply could not have been carried out for logistical reasons.

  • Even at 1080p, the code still appears blurry and hard to decode. This is the first indicator that no one could have possible tested the code to the level that is being claimed.

  • If I were to capture every single image, I would be here for about the age of the universe trying to explain everything if I were to adapt the same styles as I have for other articles. For brevity, there are only eight more images after this one, and for practicality reasons, I won’t bother explaining what’s on the screens.

  • This is as close to the code as we can get. Syntax-wise, I do not notice any issues with the code. From a cursory glance, I note that there are a lot of prototypes. However, inspection of the code in the close-ups, frame-per-frame, reveals that all of the methods are only declared in prototypes: actual implementations are completely absent from these close-ups and must likely be in the far-away shots.

  • On careful inspection, it is possible to do exactly what Nagato does using  far fewer terminal windows. One would merely need a single C program that has access to networking privileges  The program would need to convince the server that it is an administrator, and from there, it is a simple matter of creating a class to mimic administrative commands, thus allowing Haruhi et al. to even out the game. 

In the context of the story, Nagato designs a remotely executed program to even the battlefield out following the discovery that their opponents, the Computer Research Society, were cheating. Nagato is seen using the command line terminal to construct her program, as well as the means of delivery, demonstrating that her ability to micro is equal to teh_pwnerer from Pure Pwnage. However, the TVTropes article draws interest, with the original lines reading as follows:

There was a fan who had knowledge of C programming and command line execution who actually took screenshots of Nagato’s code, frame by frame. The code was valid.

On closer inspection, even at 1080p, the code is blurry and can only be read to a limited extent. The code that can be read is syntactically correct, but not valid, C: running it through the compiler will produce code that does not raise any errors from the compiler, but unfortunately, there is no means of validating the code talis qualis. While the constant flurry of CMD windows does not present challenges to capturing the screenshots for inspection, the fact that the code remains  blurry precludes any possibility of inspecting it further. Thus, we are forced to conclude that, however cool it may have appeared, the code’s status is at best indeterminate. In the worst case, the code simply won’t do anything.

  • There is a scene from Lucky Star where a waitress looking like Nagato asks a customer (who happens to look like Kyon) for permission to go ahead and make the dish despite it taking 15 minutes, and the customer responds in the exact manner as does Kyon here.

  • This is the clearest we’ll get to see the screen. For the record, yes, it’s correct. The first line is to compile her program, and the second is to run it.

  • The aforementioned shout-out to Haruhi from Lucky Star is a clever one: it is partially because of the numerous references in Lucky Star that I bothered to pick up Haruhi.

  • Kyon understands Nagato’s desire to win. This marks the turning point in various spin-offs, where Nagato becomes increasingly engrossed in games to the point where gaming displaces her old hobby of reading.

  • Despite being only human, both teh_masterer and teh_pwnerer from Pure Pwnage display (respectively) superior and equal über micro. I will discuss Pure Pwnage in greater detail at an unspecified point in the future, but I would like to take this opportunity to inform readers that discussions about Pure Pwnage may soon reach this blog.

I step things up one level when I bring the contributor’s usage of “valid” into the discussion. By definition, something that is valid (in this case, Nagato’s code) will meet the customer’s specifications. Thus, we expect that, if the code is valid, it would work as we wished. Because compiling without errors is not a sufficient condition for validity, we cannot determine for certain as to whether or not Nagato’s code is valid. For good measure, verification cannot be attempted here, since there are far too many unknowns. Paired with the difficulty in actually seeing the code work, this example clearly would not hold true, and as such, has since been re-written to reflect that. Until another contributor alters my corrections, it simply reads that Nagato is seen to be using syntactically correct code and CMD commands when writing her program.

4 responses to “Nagato Yuki and the C Programming Language

  1. cheesecake March 31, 2013 at 22:59

    programmers and anime.

    i think i failed my C subject in college. simply because i am too lazy to come to school. lol. but hey, i am a programmer now. 😀


    • infinitezenith April 1, 2013 at 11:36

      Grades in post-secondary are a necessary but not sufficient determinant of success 😉 That said, I do like to mess around with anime concepts using practical, applied knowledge.


  2. Levi Durham April 14, 2013 at 03:32

    The empty functions could be prototypes, where the main body of the function is given later in the file (in C, the compiler looks to see if the name is in the symbol table, if not it throws an error. Prototypes just add the name to the symbol table).

    As for your breakdown of the code, I agree with you. It’s unlikely that the show’s writers would have bothered to implement everything such that it’s correct (a lot of work for a minute in an anime). The fans who say they’ve done a frame-by-frame analysis are probably being untruthful.


    • infinitezenith April 14, 2013 at 11:17

      Thanks for taking the time to comment! I’m not a C programmer (mostly Java and Objective-C), so it’s good to learn more about different language’s subtleties.

      The story behind this post was an effort to bust a myth that TVTropes has been propagating for the past four years or so. I’ve done a thorough search, and it’s clear that no Japanese or English speaking fans have actually implemented or tested Yuki’s code. I bust the myth by going one step further: not only is the code just written with just prototypes, but the resolution of the code is too low, even in 1080p, to allow for the text to be legible. Unless Japanese fans have access to 4k version of The Melancholy of Suzumiya Haruhi (and they do not), there’s simply no way to analyse the code line-by-line, frame-per-frame. Since the fans can’t even see the code, it follows that they cannot reimplement it as they see it to test it. So, I’m going to call this one busted.


Please provide feedback!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: