Sunday, March 29, 2009

Instrument


Your Name

As morning dawns and evening fades
You inspire songs of praise
That rise from earth to touch Your heart -
And glorify Your name;

Your name, is a strong and mighty tower
Your name, is a shelter like no other
Your name, let the nations sing it louder
Cause nothing has the power to save, but Your name.

Jesus, in Your name we pray;
Come and fill our hearts today;
Lord, give us strength to live for You
And glorify Your name;

Your name, is a strong and mighty tower
Your name, is a shelter like no other
Your name, let the nations sing it louder
Cause nothing has the power to save, but Your name.

---


I originally thought I ended up there by chance, but my experiences at MCYC have shown me that sometimes it is in the things I least expect to have an impact on my life be meaningful. I initially came, somewhat unaware of what I was going to do, and somewhat in a pursuit of CAS and an NYAA Residential Project. However, now I do feel that the experiences of bonding, and getting to look at issues from varied perspectives have been beneficial, more so than a bunc hof CAS hours or the NYAA project. My overall experiences there far exceeded what I originally expected.
I'll miss many of them there. I looked at the Excel CAS attendance table spreadsheet, and... it just seems to have passed so fast.

I know I'll try my best to visit them at the end of the year.

---

I can't quite reason why I did that, but I can say I felt called to.

jk.

Thursday, March 26, 2009

The Orb in the Night Sky Hiding the Princess

Raw, heartful desires accumulate.
They remain locked behind this sphere.

"I want to stay this way.
Leave everything in the status quo."

Her last words, before disappearing for the night.
She had her tools beside her -
Five treasures beyond conception of the average human mind.
No one could stop her; but that wasn't the point...

For fighting would not do much, but break her mind.
She locked herself, locking her world from external influence.
Her counselors and advisors couldn't understand -
Why didn't she want to go back? Life there seemed so much better;
The work-days then lasted but three or four hours a day...
Back there, she was a Princess. Here, she seemed but a fugitive.

So, tonight; she heard of the group coming to take her back,
And she focused her mind, built her own cage -
The Orb in the night sky holding her, the princess.

adapted from the story of Touhou 8 - Imperishable Night
---

In other Touhou though non-random poetry news, I had a very weird MoF Extra run today. I reached Suwako 5/5 as per normal, but then died on super-easy cards: 2 bows 2 claps (a pure trick card - incredibly easy!) and long-arm and long-leg (another trick card!). I survived most of the rest of the way, dying once on Jade of the Horrid River (careless) and then near the end of Suwa War. So I faced Mishaguji with 0 lives, 5 power. I bombed once, and capped it. A rather bad run, though I think I did pretty well on Froggy Braves the Elements, with only one bomb on it. Only captured 2 cards I think - Kanako's second, and Frog Is Eaten By Snake due to Croak thingy. Normally, capturing 2 bows 2 claps 1 bow, Long-Arm and Long-Leg, and 7 Stones and 7 Trees (and possibly also Moreya's Iron Ring) could also be done... I wonder what I was thinking then.

jk.

Saturday, March 21, 2009

fall through

I thought things would have been fine after yesterday, but I guess not.

I've been sleeping at about 1-2 every night for the past few nights; and I guess it's because I've been doing work till then. I never expected it to reach the point it did yesterday though; I spent 2 hours in the morning writing the World Lit essay, worked on math port, and then a physics IA. I hadn't fully finished the physics IA (about 90% done), but I just crashed and fell asleep at about 2.30am, almost completely involuntarily. The lights were on, I hadn't brushed my teeth; et cetera. My mind just feels weird - "big, strange and foreign" to the rest of me.

---

No BS today. It was weird. I went to school at about 8.50 am and I saw only the year 5s in the Primers' Room. I was like - ok, let's call Luke, since he told me yesterday night it'd be at 9 am.

Call 1 - Luke - No response.

I thought, hm, who else might be aware that there might be BS/might not be BS? Well originally when finding a day to go out Russell suggested Saturday after BS, before remembering he had something on then; hence he must have expected there to be BS, so...

Call 2 - Russell - Says Jayne said no BS

To find a 3rd opinion...

Call 3 - Shaun Ong - Not sure, suggests I call Mr Lee

I was going to anyways, but since Russell suggested check with Jayne,

Call 4 - Jayne - No response.

One last time just to check:

Call 5 - Luke - No response.

So.

Call 6 - Mr Lee - No BS today... originally supposed to have, but feeling unwell...

I planned to do some English in school but decided against it (too sian) and just went home to emo and do Econs IA5.

At least term 1 seems to be the toughest term of the bunch...
jk.

Thursday, March 19, 2009

Pendulous

junyi: although 6 days isnt much better than 4 days
jk: well at least its quite reasonable
junyi: u get sick, 1 day later u feel ill, u decide hey lets just go for sch i should be ok
junyi: saturday you drop dead
junyi: therefore lesson learnt from math port, if u feel sick pon sch and see doctor b4 u die
jk: haha win XD
(oh, and get treatment by the next day! or else.)

It's these little moments of humor that can really serve to brighten up an otherwise dreary and boring day at times. Thanks! =)

---

It's been one of the tougher holidays for me - working up to 2 AM for a few nights and from 6 to 13 hours a day has really had a draining effect on me. I guess I've still been making time for my friends, been catching up with them over the phone and all, but I can say that I haven't really had a chance to just rest completely.

At least my outlook on things has changed since Friday night. It's really something I'm thankful for.

jk.

Saturday, March 14, 2009

Trust and Obey

When we walk with the Lord, in the light of His Word,
What a glory He sheds on our way;
While we do His good will,
He abides with us still,
And with all who will trust and obey.

Trust and obey, for there’s no other way
To be happy in Jesus, but to trust and obey.

But we never can prove, the delights of His love
Until all on the altar we lay;
For the favor He shows,
For the joy He bestows,
Are for them who will trust and obey.

Trust and obey, for there’s no other way
To be happy in Jesus, but to trust and obey.

Then in fellowship sweet
We will sit at His feet,
Or we’ll walk by His side in the way;
What He says we will do, where He sends we will go;
Never fear, only trust and obey.

---
Why doesn't anyone know "You Are"? =(

I thought it would be fine, since on Thursday in pt 16 during the first practice
Jeremy: "This song is really nice, it's meant a lot to me."
Luke: "God has used this song to speak to me before..."
Russell: "The third song is...?"
(Luke sings the first line - "You are Glory, You are faithful")
Russell: "Oh, I like this song."

---
Thanks to JX and Shaunlee for organising a camp where you had to "be serious and yet have it a fun camp". Having that kind of balance isn't easy.

Thanks to HJ and XM for talking to me a bit after worship; I was quite drained. Thanks.

Thanks to Luke for having confidence in me and playing the guitar for worship today, as well as for discussing with me several pertinent points with reference to faith and worship. Really. It's a lot... thanks! :)

Finally, thanks to God for guiding me through worship, the POP camp as well as the NOI, and for just speaking to me quite a bit for the past 2 days. I know I need to re-gain the discipline I once had with reference to spiritual matters and at least now I can visualise myself successfully doing so, which is a key step on the way to real successes. Also, the choice of this song. I originally wanted to sing Tim Hughes' "Living for Your Glory", but I somehow heard a calling, "Do "Trust and Obey" here instead." I played it down as a random thought of an overactive mind, but then when Luke also said the song's more suited for a solo performance and the chords were too hard, I went home and prayed over it, and the song "Trust and Obey" re-surfaced again; hence, I chose it.

jk.

Thursday, March 12, 2009

Q&A in a blue ocean

what i might have said, if i was on the stage
---
"what are the 7 things in SQA?"
(honestly i wouldn't try answering this one)
"1. leadership 2. customers 3. processes 4. results 5. information 6. people 7. management?"
(aside: that was typed without referencing, and isn't quite right. PLANNING not MANAGEMENT.)
---
"are you wearing school socks?"
"hmm yes." *pulls up pant leg to reveal school socks*
---
"can you sing the school anthem without mistakes?"
"in days of yore, from western shores
Oldham dauntless hero came
and planted a beacon of truth and light
in this island of the main
here may it stand, from year to year
emblem of grand endeavour
the regions round echo the sound of ACS forever

sing ACS forever more, our ACS forever
God save our land and Heaven bless our ACS forever

our students hail from China's plains
and the land of rising sun
we have many sons from India's strand and the islands of the main
our hearts our hopes, our aims are one
no discord e'er will sever,
we'll stand together for the cause of ACS forever

(repeat chorus)"
(side note: yeah i typed that without referencing, from memory)
---
"what colour do you bleed?"
"red. red is a colour associated with passion; furthermore by saying red I am showing you that I will do my best in being a truthful and direct councillor. I know of the possible metaphorical underpinnings behind the question, but in a situation like this why not just go straight to the point?"
---
"how far is initiative a part of responsibility?"
"okay. to answer this i'll first establish the parameters for initiative and responsibility - responsibility as what is expected of you, both in a mechanical sense as well as in the social-societal sense, and then initiative is what you choose to do out of your own intention, typically above and beyond what is established for you as responsibility.

so i'd say no; while it's true that we should go out of our way to help others, beyond our responsibility (IE initiative), we should only do so as far as is reasonably comfortable for us since we can say that that would violate responsibility to ourselves. the idea of expecting initiative, presenting it as a responsibility, is dangerous."
---
"it has been said that leadership is lonely, so what'll you do to maintain connected with others?" (not too sure how close this question was to the actual one)
"having some personal experiences in this area, i will apply my best efforts in maintaining open communication lines and allowing for participation of the student body in decisions, using the frameworks of forums and referendums(i'm not sure if this is the right plural form). generally for more minor decisions referendums may be acceptable but for major decisions forums are better recommended since they allow an expression of consensus rather than plurality. i know it's tough but i'll do my best."
---
"what is one practical initiative you can do right now to change the school for the better?"
"implementation of better assembly discipline control, for the y5s and 6s. eg by stationing more people there and asking the CTs/PCTs to be more vigilant?"
---
"i see that few of you have got many acad awards or are renowned sportsmen, so what makes you think you are worthy to run for council?"
"despite having received quite a few acad awards, i'd like to say that i don't think these should be prerequisites for running for council. i mean, while it is true that asking those with academic awards and/or renowned sportsmen could possibly have some kind of correlation with responsibility, intelligence and other positive traits that might be expected of a councillor, i think that the most important trait a councillor should have might not correlate so well with these two. personally i feel councillors require a heart of service for the school; i see this as to some extent different from acad award recipients / sportsmen in the sense that the latter seem to gain glory that's largely personal, while it's true that councillors get a nice CV, the tasks seem to be of a very different nature. so it's really not about winning loads of acad awards or being a renowned sportsman, but more about showing that you care and really have a heart for the school."
---

As a side note, I've been talking about it for a few days now, but "You Are" is awesome. I first heard it during Mr Kan's worship during a Chapel sometime last year; I found it a rather interesting song, with descriptions reflecting different facets of God. I didn't remember it much later until Shaun Lee gave me the Faith CD for my birthday, which had Mark Roach's version of it (presumably the original; at least, he composed it as well). I started listening to it more since I'll be singing it for worship on Saturday and... yeah. It's a really beautiful song.

Also: Physics Test, survived with 24. In my class I think that in addition to that only Clarissa and Nick Lim passed. Math Test: Wow I never realized my math class was so pro at math, with plenty of scores on the high end of the 40s! Oh, and my results are =D

jk.

Headphones

I'll be leading worship on Saturday for the POP camp. It'll be a simple affair, with just me and one guitarist (Luke). I figured out the songs about 2 days ago or so actually, but I felt this was worth a mention cause one of the songs I picked, "You Are"... I really feel somewhat even... called to sing it. I'm listening to it now actually, preparing for practice tomorrow so yeah.

---

discipline.

what happened to it?

oh noes
jk.

Monday, March 09, 2009

C.LAZY_CAT

I guess I'll be writing a series of computer science-related posts as and when I have the time; it's a good way to blow off some steam after a high-adrenalin academic activity.

Today I will be discussing problem C from the National Olympiad for Informatics 2009, Singapore. This problem, known as LAZY_CAT, is quite significantly harder than most of the previous NOI questions that I've seen (for example, 1999 has only three problems and they are all much easier). It's roughly about a problem 5 or 6 standard on the previous local NOIs. That said, it was one of the two problems that I could devise a proper algorithm to solve.

In general, the NOI was a great experience; the challenge of quickly absorbing and then applying a new programming language of C++ was definitely very interesting. That said, I'm lucky the competition focuses strongly on algorithms and not on skilled manipulation of the language.

LAZY_CAT essentially involves a cat starting at a position "S" that moves around a square grid with maximum dimensions of 10 times 10. The cat moves only orthogonally (i.e. up, down, left, right.) one step at a time around the grid, and must remain within the grid at all times. The grid itself contains four main types of squares: "0" meaning a blank square, "F" meaning a square that contains Food or Fish (not too sure which one), "B" is the cat's Bed, and "X" is a wall that the cat cannot step on. The aim is to get the cat to eat all the Food/Fish and then get to the Bed to sleep in as few moves as possible - or rather, on the programmer's part, to design an algorithm that returns the minimum number of moves required to get the cat, from start S to eat all Food and then go to Bed.

The parameters of the question setting are as follows - the memory cap is so large that it might be ignored (it is on the order of magnitude of one gigabyte). The cap on computational time is 10 seconds. Also, the grid is between 3 by 3 and 30 by 30, and there is a maximum of 10 pieces of Food/Fish on the grid.

For example, a sample grid might be as follows.

X0X
0FB
SFX

In this case, the minimum number of moves for the cat to eat all Food/Fish and then go to Bed is 3. The cat moves right to eat one piece of food, moves up to eat a second piece of food, and then goes directly on to the Bed. No better solutions are possible; hence the program written given this input should return 3.

Sometimes, however, the cat just can't do anything. For a simple example,

FFF
XX0
SXB


Obviously the cat has no legal moves and hence can't do anything! In this situation the program should return -1, for an input with no solutions.

I spoke to Hui Jun about this question, and he suggested a brute force method, much like, according to him, what chess programs often do (play a move, see the consequences, and do this for all possible moves and submoves). Of course, this is an inefficient approach and is furthermore made unacceptable by the strict limit on computational time. The solution I have implemented does involve some optimization, but is consistently able to give a correct answer within the prescribed time limit. In a way, it works somewhat similar to how some chess programs execute pruning methods, such as alpha-beta pruning to optimize their efficiency.

The algorithm I have designed involves a recursive call to a function I have defined as test. The function's method signature may be seen below:

test(int x, int y, int Foods, int Moves, char[] modGrid)

x and y refer to the current position of the cat, Foods refers to the number of foods the cat has eaten, Moves refer to the number of moves the cat has made up to this point, and modGrid refers to the present state of the array. This is important, because squares which had food will no longer be considered to have food - in other words, they will have changed from 'F' to '0'. Of course, we cannot just use a global variable for this since in some of our candidate solutions, some foods will have been eaten, but not in others.

The function stores the values of the first four variables into a system of four parallel arrays that will be discussed later; it then recursively calls test to create four new solutions for evaluation that represent motion in the four directions. If the square being hit is an 'F', Foods and Moves will be incremented, the modGrid will be changed along with the relevant changes in x or y, and the function will be called with these different values; if an 'X', the solution will be rejected and the function will not be called to generate a new solution. In this way, solutions that go nowhere will die out. If an 'O', or 'S', it'll just be passed on with the new x and y, and the modified value of Moves.

You might be asking: what's to stop the cat from travelling infinitely between two '0' squares? Well, (fortunately) I thought of this problem as well, and wrote an if-else conditional statement to block solutions exhibiting the following properties:

(x,y) match an (x,y) in the array of all solutions
Foods is less than or equal to another solution
Moves is equal to or more than another solution
(block equal moves only if food is less)


This will eliminate inefficient solutions and get rid of such problems - once a solution travels from say O left to O right, it will reject immediately travelling backwards to O left, since the pairs of (x,y) will match, Foods will be equal to the previous solution but Moves will be 2 more than the previous solution.

Also, in the event that 'S' is reached with all Foods found, there is not much point in continuing to roam around - the cat should just go sleep, being lazy after all. Hence once we have a full solution, with coordinates matching that of S, with all foods collected, we immediately eliminate all of the other solutions since they cannot be more efficient than the solution already found.

It might seem like a very computationally intensive approach; I don't doubt it is. I guess that's why the board was limited to 10 by 10. It doesn't seem to take that long to traverse the long stacks of recursion this program creates - the algorithms to "weed" out bad or inefficient solutions do their job quickly.

Because I have to parse the entire array of possible solutions each time a new solution is generated, this requires cubic time relative to the total number of solutions M (quadratic each time, multiplied by the number of times it must be done, which is once per solution). Recursion, which determines the total number of solutions, can be said to be proportional to 4^N where N is the grid size.

Hence M = 4^N and T = kM^3
T = k * (4^N)^3

So... the algorithm seems to run in cubic exponential time. I hope I'll be able to find a better solution, this works but looks terrible! The problem definition allows for such algorithms, but I do hope there is a better way of doing this...

Wednesday, March 04, 2009

Role Reversal

Something's wrong with my subjects this term, I think.

HL1: Maths
I had a test today. A rather okay paper for me, though quite firmly on the hard side relative to most IB HL Math papers that I've seen. I lost about 5 marks I think because my Volume of Revolution answer (the very last question) was terribly complicated (so probably wrong). Well, I just hope I can still pull out a rough 7... I'm assuming that's about 83, so 50/60. I hope I didn't lose 5 more marks, yet I'm quite sure I did. Somewhere or another.
Self-Predicted Grade: 6

HL2: Computer Science
About 5 + 3 + 2 = 10 marks gone out of 60; I had no idea how to create a virtual non-dedicated device (5 marks), ran out of time for the binary tree deletion algorithm (did most parts, except the i have 2 children deletion, so can probably get about 4 of 7) as well as didn't have time to answer a question on serial vs parallel connection in networking (2 marks). Well, I'm very sure I didn't perfect-run the rest of the paper, so...
Self-Predicted Grade: 6

HL3: Physics
Whee! Let's just fail.

Seriously, it was hard but probably not as hard as many people made it up to be. I screwed up countlessly; I misread a number from the GDC (10 power 7 and 10 power 8), and because of that lost about 7 marks I think. B fields question and circular motion, I ran out of time. So...
Self-Predicted Grade: 4

SL1: English A1
Ispahan Carpet was awesome. I was hoping for a little bit of marks on the high side to scratch the surface of a 7, but I guess not this time.
Self-Predicted Grade: 6 (7 is being too optimistic)
Actual Grade: 6

SL3: Economics
I saw the test paper and was quite relieved, though I felt a bit cheap choosing question 1 to dodge the new topic of Unemployment. They should just have set 2 questions, 1 on unemployment and 1 on inflation to stop people from doing this kind of stuff. Oh well, not difficult at all.
Self-Predicted Grade: 7
Actual Grade: 7

Wow. Unlike last year, where my HLs dominated my SLs (7 7 7 - 5 7 6), this term looks like an almost complete role reversal (6 6 4 - 6 [7] 7)!

---

On another note, I created a very nasty mathematical problem based on what I learnt from Econs as well as Math...

Suppose you have two economies A and B producing two goods, X and Y. Partial units of goods are considered lost and the resources wasted. The PPC for economy A is modelled by 8x^2 + y^2 = 100 000 000 and the PPC for economy B is modelled by x^2 + 2y^2 = 51 840 000.

Consumers of the goods value them at the following rates:
the nth unit of good X produced has a utility 4/(3n),
the nth unit of good Y produced has a utility 3/(4n).

Find the maximum possible total utility achievable between the two groups of people supported by the two economies, assuming that free trade, with zero tariffs and zero transport cost, is allowed to take place between the two countries.

For a bonus challenge, be like Keynes and do this without drawing the graphs. Seriously, modelling impressive equations without drawing the graphs is awesome.

jk.