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!
Sunday, 9 February 2014
Monday, 3 February 2014
Recursion and Cheese!
Week 4 has come and gone: The central topic this week was recursion. Though it was an overwhelming idea at first, there was one example that stood out amongst the rest in it's explanatory power: Thinking of a problem as a set of smaller but similar problems. Then, consider the subsets of the same problem within those subsets. You carry on this process until the base case is reached and then add everything together to solve the problem.
Working through some recursive examples was a bit difficult at first since I was treating every subset of the problem individually rather than seeing the same solution work for every subset and then ultimately culminate to the final solution.
All in all, recursion is definately a great addition to my 'programming toolbox' and I see many uses (both past and present) for it.
Speaking of present uses of recursion, the next topic of the week was Assignment 1.
A1 is based on the famous Towers of Hanoi problem. This assignment has us trying to move stacks of cheese with towers of hanoi-esque rules.
Though the assignment (currently working on it) seems quite challenging, I like seeing all that I've learned being put to use in one exercise.
I recognize that many aspects of the programming world emphasize teamwork and coordination, but I have decided to (for now) work alone. This will give me the oppurtunity to test my comprehension of learned topics in a rigourous way. Hopefully that will be good prep for the upcoming mid-term.
Well, that's all for this week - good luck to all on assignment 1!
Working through some recursive examples was a bit difficult at first since I was treating every subset of the problem individually rather than seeing the same solution work for every subset and then ultimately culminate to the final solution.
All in all, recursion is definately a great addition to my 'programming toolbox' and I see many uses (both past and present) for it.
Speaking of present uses of recursion, the next topic of the week was Assignment 1.
A1 is based on the famous Towers of Hanoi problem. This assignment has us trying to move stacks of cheese with towers of hanoi-esque rules.
Though the assignment (currently working on it) seems quite challenging, I like seeing all that I've learned being put to use in one exercise.
I recognize that many aspects of the programming world emphasize teamwork and coordination, but I have decided to (for now) work alone. This will give me the oppurtunity to test my comprehension of learned topics in a rigourous way. Hopefully that will be good prep for the upcoming mid-term.
Well, that's all for this week - good luck to all on assignment 1!
Subscribe to:
Posts (Atom)