Archive for December, 2009

SCORE Computer : analysis on failure of the contest environment

Well, firstly to whom doesn’t know yet, on the 4th of December my school hosted a programming contest called ‘SCORE Compute Contest’. It is just a basic programming contest that the competitor have to write a C program to solve given problems. To make this more fun and not IOI-like, the Head make an extra system for it, but that’s out of scope for this post.

I’ve been assigned to write a contest environment (i.e. grader). It is a system, mostly web-based, for the competitor to submit their solution to be compile and grade using the restricted environment (i.e., sandbox-ed). My code was MVC-based PHP code that I use very clear variable name, for I have little time and it must have as less bugs as possible.

While I was testing it, I have fixed almost all important bug. It ran very well that time. But the problem come when the real competition was started. Some solution putting the grader in full-locked situation! I don’t know what caused that, and I’m very stressed, so I blame the sandbox which I use the Moe Contest Environment’s. So far, our Head have a solution, and therefore the contest end pretty well.

After many hours of sleep, my head went bright and I realise what caused it. Guess guess guess…. It is the IPC!?! Old way I use is to pipe the sandbox process’s output through streams. I carefully check that I have already closed all stream before terminating the process (proc_close(), my grader is written in PHP). But somehow I realise, that IPC may caused deadlock if not very well implemented. And I’m not sure that the wrapper for piping process’s I/O I quickly cook was really bug-free. So far yesterday I come back to the grader and change from piping through the stream to piping to filesystem. And it works!

UPDATE: The working system I wrote can be found at http://napv-ce.googlecode.com/ There will be no more update to it.

The Flow of thought — then get interrupted!

Have you ever face this before? When you were in the middle of your wonderful and flowing thought and was writing it down quickly. You know that this opportunity of getting this flowing thought is very low. But then your parents interrupted you, claiming that is is time to blah blah blah… So your flow of thought was interrupted, and it never come back again!

Well, my thought really flowing this afternoon. I was writing a rather hard essay, then I was interrupted and now I don’t know what to write any more — it’s all gone! How annoying!