2015年1月31日星期六

About Week 4

We goes to recursion in week 4. Somehow I think I gradually follow the class of CSC148. 148 focus on general idea and does not do as much practice as 108. Yes, we do have labs, but I do not think I works as well as PCRS.

Recursion, in short, means use the definition itself to define the definition. It has certain pattern:

def mm(L):
    """
    (int or arbitrarily nested list of int) -> int
    
    Mystery method.  Exactly the same as sum_list,
    except for the last line
    """
    
    if isinstance(L, list):
        return sum( [count(x) for x in L] )
    else:
        return 0

Here the isinstance(X, type) is always there because we need to decide whether to recurs L or end L. By this way we peel the L like an onion until it becomes the very basic element. In the example above L may originally be a list, and after recurs L again and again, the lists would be broken and separated into small elements.


2015年1月24日星期六

About Assignment 1

I have made the game itself. But still not work well with the idea of class, subclass and so on. Need to study and spend more time on it.


Why Geek should write?

The question supposes that a computer science student is a geek, which is a wide stereotype. However,I do not regard myself as a Geek. I call myself an artist. Code, just like pen and brush, is just one way to present the thing I want to say.

I studied art for three years in high school and had a lot of works. I do enjoy the process, but gradually I realize there are something cannot be achieved by using pencil and brush. Also, I wrote a lot of fiction stories when small, and I am not satisfied with this way to present what I want to say since words are too bald. Then, I found a new called programming. Programming makes thing more alive and interactive. For example, video game and animation are ideal ways, for me, to tell story as they are really interactive and gorgeous. And I do need some knowledge of program to achieve these. Now back to the question, I write for fun, or to express what I want to say, so is the reason for program, drawing, and so on.

PS: My work in Grade 11

2015年1月22日星期四

something about this week's lecture.

It has been three weeks from the beginning of semester. I do feel CSC148 is much harder than CSC108. In 108, everything seems so applicable. There are huge amount of practical work example you can learn from, and a lot of practice you may work with (such as the performance part PCRS). In CSC148 everything seems so conceptual, we no longer focus on exactly how to solve the problem, but on the big idea of problem solving.

This week's content is about class and subclass. I know the idea like subclass would inherit properties of classes, and may also alter or override method in parent class. However, when it comes to the tutorial which asks me to write an actual example using class and subclass, I lost myself at all. I think that is because I do not get in touch with some detailed examples.

We all see this in the course:

class A:
   def g(self, n):
      return n
      
   def f(self, n):
      return self.g(n)
      
class B(A):
   def g(self, n):
      return 2 * n

a = A()
b = B()
print("a.f(1): {}".format(a.f(6)))
print("b.f(1): {}".format(b.f(6)))

This example explain the idea of overriding very well, but it is too simple and is hard to apply.

Now I am trying to approach more resource online and learn by myself, but I am really worried about the future of my CSC148... 

2015年1月21日星期三

slog for CSC148

I firstly got in touch with the form of SLOG in CSC165, last semester and everything required for a slog is similar in this CSC148 course.

Thus, I decided to keep this site I created before for the CSC165 and updated to keep in track with the content of CSC148.