Sunday, 9 February 2014

A Look Back at Week 5: Scopes and Assignment 1!

Hello readers!

We're into week 5, steam-rolling through the winter term and the assignments and tests are sure piling up! The latest (well first really) CSC148 assignment is based on the famous Towers of Hanoi game. Instead of the usual 3 pegs, our version has us dealing with 4.

What's really interesting about this is that the most optimal solution to Towers of Hanoi with more than 4 pegs has yet to be proven! Many great minds have probably tried solving this problem and it feels great knowing that we are going through the same thinking process they went through!

I chose to work alone as I usually do for CS assignments; though I was first a bit frustrated with understanding how assignment one was meant to be structured, I did eventually figure it out (thanks to everyone on the Piazza forums!). It was nice to see how the different topics we discussed in class so far (inheritance, basic data structures, recursion etc.) fit together to make up a working solution.

Although I haven't yet managed to find the most optimal algorithm for solving the 'four stool (or peg)' Towers of Hanoi game, I have come quite close to it. Hopefully, I will discuss my solution (and alternatives) more thoroughly after the assignment deadline has passed ( to give everyone a fair chance of course :-] ) - but the hardest part by far has been figuring out what values of 'i' to use; I think the answer to the most optimal solution lies there - though I haven't found it yet.

Besides the assignment, the other highlight of the week was the lecture topic on scope. This is yet another familiar topic for me though I haven't used it much in the past. My past instructors told us to avoid using global variables (most of the time at least) as they can make code harder to understand and can start polluting namespace.

Is was a little difficult, but after looking through the examples (of predicting outcomes) in lecture, I was able to refresh most of my memory on this topic.

I've also finally had a chance to read through some other Slogger's posts. A couple that really caught my eye were: cynnGAH's Slog (http://148journey.blogspot.ca/) and Ada Ene's Slog (http://adauoftcsc148.blogspot.ca/). They were definitely fun and informative reads. cyannGAH's Slog was particularly fun to read as they summed up the weeks topics in a rather witty and fun way. It's nice to see how these Slogger's and others have dealt with understanding the topics discussed in class and it definately gives you a neat sense of perspective to see the topics through someone else's eyes!

That's all for this week - good look on your mid-terms everyone!

No comments:

Post a Comment