The Infinite Zenith

Victory costs. Every time, you pay a little more.

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. :D

    • 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 are called prototypes. The main body of the function is given later in the file.

    When you call a function, the compiler looks to see if the name is in the symbol table, if not it throws an error. The empty function just adds the name to the symbol table.

    • infinitezenith April 14, 2013 at 11:17

      Unfortunately, I notice that a great many of these prototypes lack implementations. Having looked through all the code, my point still stands. That said, thank you for pointing it out: I’ve made the necessary updates to the post. I am predominantly an Objective C and Java programmer, so my lack of total familiarity with C may be forgiven.

Please provide feedback!

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

WordPress.com Logo

You are commenting using your WordPress.com 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