Friday, 25 October 2013
Trees, Binary, Tuples. - Week 4
Binary trees are very interesting with all their applications, like the ability to use nodes in a queue and such. The exercise was quite straight forward, with the exception of part b in which I kept getting lists within my node lists but a simple list comprehension solved my problem. I managed to solve the exercise without helper functions thanks to tuples, something that I was introduced to this year as I had programmed in java. The usefulness of tuples has actually become very apparent now, it really simplifies things when I can return a small tuple.
Wednesday, 16 October 2013
Testing Shenanigans and Binary Trees - Week 3
Today I had my first mid-term, which was CSC148, it taught me that I need to really get back into my test-taking habits. First of all: read the question carefully. The number one rule that I apparently forgot, when glazing over i ** 2 my brain thought, "Oh! i multiplies 2" rather than "i to the power of 2". And of course not diving into a question but rather thinking about how to solve it, because the latter in the long run wastes less time.
For indentations I've developed the habit of pressing four spaces. Thank you python! With trees and their preorder, postorder, and inorder everything seems to revolve around recursion. While I learned how to make these trees from simple input, I never really learned how to make trees from the preorder and postorder. Quite an interesting task, it required much more thinking and pen and paper than typing. Ever since my first difficult computer science assignment (the tour of Anne Hoy) I've been thinking things out first on paper as it really does help. It has shown me that in the end, everything boils down to recursion when it comes to trees. Recursion is great, when you understand it.
Thursday, 10 October 2013
Object Oriented Programming and Recursion - Week 2
I have found object oriented program to be a lot more enjoyable than non object oriented as I first learned programming in Java, the instant feedback of what I have programmed is very gratifying and helps me as I learn better when I see things happen. The goal is to become a human python visualizer. Creating classes feels at home as in java I always had to make classes.
Recursion has proven to be a very useful programming technique that shortens the length of code drastically. In general the compact form of recursion is very nice to be able to write, however it can sometimes be very confusing and take a while to think through step by step. The best way to judge it is by just going through a case.
For example, with the lab this week the binary notation function we had to create was quite difficult to understand until I went through a case with it, realizing that a base algorithm would work when the binary expression is put back in shorter and shorter.
For example, with the lab this week the binary notation function we had to create was quite difficult to understand until I went through a case with it, realizing that a base algorithm would work when the binary expression is put back in shorter and shorter.
Monday, 30 September 2013
Hackathon - Week 1
This will be my first SLOG post for my course CSC148 at University of Toronto, we are required to make weekly blog posts regarding our classes and CS related things. Our first assignment was introduced, and it seems like it will heavily involve recursion as anything with algorithms like the tower of Hanoi does. I suppose its important to understand that everything expands off of the base case.
The past weekend I went to the U of T hackathon as a "hacker", I found it a great experience and will definitely go next year. I had no idea as to what I would make or with whom but when I showed up I sat next to a fellow CSC148 student(http://maxwell.huang-hobbs.com/blog/) and we started to brain storm a game. It started out as a roomba cleaning arcade game then over many changes turned into a paint war game where you would vie over control of zones by painting a grid. The main issue and bane of the game as we programmed was the movement system. A freeform movement system was implemented however with calculations of where to randomly spawn pickups, collisions between the police officers and players, and collisions with the boundaries of the map when the player got a speed boost proved to be very difficult without a grid based movement system. So when we tried to revert the movement system, which was involved in everything into a grid-like system it was already too late so we were unable to finish the game in time for judging. Heres a link to the github repository page: https://github.com/Huang-Hobbs/paint
The main thing I learned from hackathon was how to program with groups of people and ultimately how to use github, something that will most definitely help me in the future. Plus all the free food was worth it. Also I'd like to apologize to my teammate for not being at hackathon all the time, I enjoy my comfortable bed.
Subscribe to:
Posts (Atom)