Thursday 28 March 2013

The Third Trial of Zenness

The other day, my brother was playing a game on the Xbox. What is an Xbox you ask? It sounds so familiar. Well, an Xbox is one of those legendary video game consoles that students would go home and play for hours at end during high school, back when we had the luxury of free time. Anyways back to my brother. He was playing a game called The Cave. For those of you who don't know, The Cave is a hilarious problem solving game (think Portal, without cake) quite dark at times, yet satisfyingly challenging. My brother was stuck on a level in which he had to help a monk achieve 'zenness.' And he swallowed his pride and asked me for help.

In this specific level, there is a sign that says, "An ordered mind seeks equilibrium in all things. A sloppy mind just uses the internet. http://monkpuzzle.com/." Just to the right of the sign was an unbalanced weighing scale with a six gallon jug at one end. Further to the right were two more empty jugs - one capable of holding 7 gallons, and the other 4. Beside that was a lake. It immediately reminded me of the 'penny piles' puzzle from class. My first thought was that I somehow needed to get 2 gallons in the bigger jug and then pour a full 4 gallon jug of water in that, thus giving me the equilibrium level of 6. My steps, in great detail are observed below.

'7' Gallon Jug(A)    '4' Gallon Jug(B)
0                           4 # Fill jug B
4                           Empty # Pour B into A
4                           4 # Refill B
7                           1 # Pour B into A thus leaving one in B
0                           1 # Empty jug A

At this point it was just a repetition of  this algorithm
1                           4 # Pour B into A and refill B
5                           4 # Pour B into A and refill B
7                           2 # Pour B into A... again
2                           4 # Empty A and then pour what's left in B in and then refill B

Aha! I had finally reached the level that I had aspired to. Now it was a simple task. Pour the 4 gallon jar into the 7 gallon jar thus obtaining the required equilibrium level of 6. Level complete. My brother was left in awe yet again.

The next day, as I was on the subway, a thought was nagging me. Yesterday's solution seemed too complex. Surely, there's an easier way to solve the puzzle. After a bit of thinking, I did come up with a 'more efficient' solution.

'7' Gallon Jug(A)    '4' Gallon Jug(B)
7                           0 # Fill A
3                           4 # Pour A into B
3                           0 # Empty B
0                           3 # Pour A into B
7                           3 # Fill A
6                           4 # Pour A into B

And voila, we have equilibrium! This solution was much simpler and much more elegant than the one I conjured up on the previous day. However, the nagging feeling persisted. What was I missing? The better part of the day was spent filling, refilling, and pouring (smashing them served no purpose) water into hypothetical jugs. And after some soul searching I came up with an even better solution. The solution was so blindingly obvious and I don't know how I possibly missed it. It was all in the sign: "An ordered mind seeks equilibrium in all things. A sloppy mind just uses the internet. http://monkpuzzle.com/." And sure enough, there was the answer; on that very website. It was quite maddening really. Kudos to the game designers though. At least, (I tried to console myself), it shows that I have 'an ordered mind.' Small consolation that it was.





Thursday 21 March 2013

Debugging Test 2

What can I say about test two? For one, it wasn't entirely complicated. It was based on material that was already covered at some point in class and therefore, no curve balls were thrown. It was just what the professor promised and the student ordered. I usually am a very slow starter, test-wise, and spend more time than necessary or sensible on the very first question. Don't ask me why, I don't know myself. However, this test was different. I flew through the first question like it wasn't even there. This was mostly because I had a very similar question lurking somewhere in the middle of my cheat sheet! Then came question two. Meh, it was alright. Question 3 did require a bit more ingenuity and thinking but certainly not enough to cause a nervous breakdown. All you needed to do was understand the definition and apply its contrapositive to the proof. I felt extremely good about that test, possibly because the opioids were raging uncontrollably in my head at that point. Its not often that you come out of a test feeling this great, and even rarer so at the fine institution that is U of T; it was a moment to savor. 

Here's an awesome take on the test:

http://notaslug.blogspot.ca/2013/03/post-7-post-test-stress.html#

Thursday 7 March 2013

WCS

Two down, one to go. The conclusion of assignment deux signals the end of the chapter on proofs. And just as I was starting to enjoy and get the hang of it too! But I'm not greatly disheartened by that because term test 2 is just around the corner, which implies more proving. Awesome. Bazinga! Either ways, I thought that the second assignment was moderate in difficulty, and some of the questions certainly needed one to dust and then don on their thinking caps.

For now though, its on to a new topic - calculating the efficiency of a program in its worst case - or as I like to call it, determining the worst case scenario. So far, I'm enjoying this topic as it involves running through programs and finding the number of 'steps' required for any given algorithm. (This is where the Python compiler in my head earns its pay) I realize that 'steps' is an arbitrary number which varies based on the definition. No one knows for sure, or at least at our level it is impossible to determine how much work a computer does to perform any given task. For now though, I'm going to try and concentrate on the upcoming test.