Sunday, April 5, 2015

Week 9: Term Test 2, weakness: linkedlist

There was a term test 2 this week, which was about recursion, linked list and some definition of tree and traversal method.

I firstly thought i did right on the definition part; however, after checking answers with my friends, i found out that there are some subtle mistakes i made which are actually influential. I misunderstood the way to count the max hight of the tree. Fortunately, i did perfect on the traversal part because i prepared well for it. Either preorder, inorder or postorder, i undertood them totally.

As for the recursive function question, i compared my answer with the solution that Danny posted. I did perfectly.

The last part and the most important part of the test : linkedlist. I knew that i was going to fail on this part because i didnt really understand the concepts of linkedlist. It's my own fault that wasn't being prepared for all questions.

After writing the test, i found out that i still have a lot of problems that are not solved yet. I might be able to write the functions and make them work fine. However, i still do not think like a computer scientist.

Week 8: Assignment 2, Tippy, MinMax.

Happy reading week. :D

There is no lecture this week because it is a reading week. Also, my result of assignment 1 has came out and i got 91% which makes me feel so goood. A nice mark is a reward for my hard work. It encourages me to keep working hard on the assignment 2.

About assignment 2, we are asked to write another game Tippy and to write a more competitive AI called MinMax. Tippy is basically a game that is played on a square board like TIC-TAC-TOE. However, there is no restriction on the size of the board as long as it is 3*3 or bigger. In order to win the game, player must complete the Z shape on the board. For example:

|O|O|X|
|X|O|O|  
|X|   |   |   (O wins)

I have finished the game part of the assignment, the __init__ function took me a long time to finally finish it, because I did not put game state in __init__. However, i notice that the game state should be recorded everytime the move apply so I change the game state into a list of list and put it in the __init__ method.

The game works well but the AI part makes me frustrated. No matter how i try, i still cannot get an algorighmn that works like what handout asked for. Recursion is still a huge block in front of me. Maybe i should communicate with people more instead of doing assignment alone. Other people might give me some insights.

Week 6: Recursion by using Tree model

This week we are still working on recursion but with a new way to understand it: tree. 

Using tree model made me confused at beginning because I cannot read the tree properly. The way tree looks like in python is different because it is hard to write a algorighm to draw a tree the way i usually do on paper, which looks like:  
       10
    9      12
  1      11  13.
Instead, the tree is being drew horizontally from left to right. Therefore, it is hard for me to read the tree. After reading it this way in many times, i start to get familiar with the tree. By using tree as a model, we start to write recursive function for counting the leaves on tree, the nodes on tree, etc. 

From my experience of writing recursive function, i get the "steps" of writing it. First of all, writing a basic case which is usually something is None, which does not occur at all. Therefore, it return something directly. Secondaly, go further, write a one-time recursion. Using counting leaves on tree as an example, recursively calculate the number of leaves on the left, and then do it again on the right. Then return the sum of them.

It's kinda abstract and hard to express the idea by using words itself. Next time i will try to give some more detailed explaination. Studying computer science, in my opinion, a major part is to understand the concepts. Getting used to the concepts would make coding much faster and easier.
             

Week 5: Test 1

During this week, I wrote the first test of CSC148 and it mainly covered the design of classes. However, I am not sure if I did it well because I thought the test time is not enough and the questions overwhelmed me during the test.

Writing this test makes me know that what I studied during labs are important because the test questions are similar to the lab questions. I found out that designing classes are kinda easy to me since I have been working on it for few weeks. The assignment 1 really helps me enhance the skill of designing classes. However, the question of tracing the recursion, i felt that i did really bad on it. I was too nervous when i was doing that question because there wasn’t much time left at that moment. I did it really fast and i am afraid of making some really stupid mistakes which i usually do when i am nervous. Every step in tracing recursive function is important since each one would affect the result. Hope that i did not screw it up from the very beginning.


I would like to share my experience of learning ADT, QUEUE AND STACK; however, I don’t feel confident talking about these. I will keep working on these and share my thoughts with you next time.

Week 4: Assignment 1 and introduction of recursion

It’s the first week that I write about what I learn in CSC148.

During this week, my professor Danny introduces us a new method to write function, which is called “recursion”. And I heard from my friend who is now in second year that I will be studying recursion for the whole course. (Obviously, recursion is SUPER important)

Also, I have been working for the assignment 1 for past few days and I notice that I did not understand the class part well in CSC108. The assignment 1 makes me understand class deeply. By working on the assignment, I began to understand why some special method is important for class such as __init__, __repr__, __str__, and __eq__. I found myself easy to get lost when I am working on object because objects are always abstract unless I create something to demonstrate them in a readable way. Therefore, __str__ and __repr__ is important since i need to be able to read and understand what is going on in my program. __eq__ is important because it helps me to keep track of the object by differentiating different objects. Most importantly, the __init__ method, it is always needed for super class and sometimes needed for subclass. It helps us to know what arguments are needed for this class. In the assignment 1, it is important because it keeps track of the game state. I study CS because i want to build video games. In this assignment, I get to know how game should be like. Although it is a super simple game with no CG or something like that, I can understand how complicated is to create a whole video game.

Actually, i think i need to talk about recursive function a little bit even if i don’t really understand how it works by now. In my understanding, recursive function is to use function repeatedly but with some limitation which is called the base case. It remind me about the proof by induction in MAT137 which we need base case too. (LOL) If there is no base case, the function will keep looping and will never haunt ? (stop?) Maybe i should talk about it later since now i only know how to trace it. 


See you next week! :D

Why geeks should write

Communication is important to scientists. Having a dream of being a computer scientist, I understand how communication would influence my career. Writing a blog that records what I learnt and did in everyday will enhance my understanding of knowledge. When i write something, i can have opportunity to think about the concepts again, more important, to think deeply. 

The communication of scientist is not only demonstrated on the blog but on the program he/she writes. The reason why programmer is called ‘GEEK’ , it’s mainly because codes they write are not readable for people that do not know coding. Programs would seem too complicated and tedious to other people. And, having a excellent communication skill would help geeks explain what they code. To be specific, the purpose of program is to make a daily life task easier for the society. In order to achieve this goal, computer programmer should know how to make a friendly user interface which can be easily accepted by the general public. 


I want to tell other people that computer programmer are not boring like they think. The way to achieve this goal, I am going to keep writing blogs that explain what I learn in CSC courses and try to “translate” jargon to daily words.