Sunday, 1 March 2015

2 - Starting It Off: Computer Science Week 4

CSC148 is definitely much more challenging than CSC108, the programming course I took last semester. While I understand how classes and subclasses work, I would have never imagined that I would be making my own game in an assignment using simple implementations like this. It's amazing to think that basic concepts you learn in class can help you figure out more complicated things and even get to a point where you are writing code to literally tell a computer to play a game with you! Imagine that!

The first week of class was just revision of what we learned in CSC108, which wasn't too hard to understand. It was during the explanation of the different special functions in which I got confused. I did not understand what the point of __repr__ was. It was until my partners and I began to implement it into our code for the first assignment did we realize why we needed it. It's definitely nice to have a good representation of what our classes can do.

I have definitely enjoyed going to CSC148 so far. At the begining of the semester I was dreading going to class due to the fact that I'm in the night section in the two hour block. I learned from my mistakes last year; doing three hours of comp sci at night could kill any student and I have no idea why they would even offer it in the first place. But Danny Heap definitely makes the two hours extremely fun and engaging; I always look forward to what other interesting class examples we'll get up to.

I am definitely looking forward to how the rest of the course will go.

5- A Summary of Recursion

This week we learned more about recursion and how to implement it into our classes for our program in the Tippy assignment. I feel like this week I have finally understood the concept of recursion without just memorizing the general skeleton of a recursive function.

In terms that aren't programming, recursion is what happens when you put two mirrors facing each other. The images inside the mirrors seems to go on infinitely, or, recursively. In terms of computer science, recursion is essentially defining a function in terms of the function. This makes the function loop on itself to solve problems such as having nested lists inside of a list.

During the first week of learning recursion, we used it to solve the nested list problem in order to get the max of said list and of the like. Now we are learning to use it in trees which can also be used in our program for our assignment which is very exciting to learn!

I am still not quite solid on trees yet, but I'm hoping if I use the Python Visualizer on a tree diagram when using a function on a method. I am also meeting with my Assignment 1 group today so I am hoping both their input and mine can help me understand recursion on trees a lot better.