Monday, March 30, 2015

Geeks and Writing

Time flies.
It is hard to imagine, the second term is about to end, which also means the first year of university is going to finish. I believe I have grown a lot, both consciously and unconsciously. I was one of the best students in high school and therefore I sometimes looked down upon others. But here, in the university, I meet the people even better than me, much better. I thought it was normal for me to accomplish the assignment in a week (several hours per day). Later I just realize somebody can conquer it in an afternoon! I thought I was one of the most hardworking students on Septemberp, but later I just believe I am one of the laziest. They are far too excellent than me. It reminds me of the first slog I wrote.

WRITING

I used to think all the programmers do not like to speak. They would rather using programs and computers to express their ideas. But I realize I am wrong after a one-year experience with computer science. Actually many programmers are quite talkative and sociable. They talk about their experience in life and programming. What will be the trend of the future technology. Therefore, the stereotype of programmers has changed a lot.

COLLABORATION

After three assignments, I gradually realize the importance of writing more than ever. It is quite difficult to conquer an assignment by a single person, including myself. Taking assignment 3 as an example, we implement each function by each self. After finishing all the functions, we compare each function one by one. We read the comment of each other in order to obtain a better solution between the two. This makes our process quite efficient. As a result, I realize the significance of collaboration.

Sunday, March 22, 2015

Week 9: About the Test and the Strike

The Test and the Strike

Before the test

A test was held on this Wednesday. Then I realized the importance of the lab. I used to think lab was useless: 'Why do we need to go to lab and practise? These are just a waste of time.' But when the date of the test was approaching, I just figured out I did not know anything in the past tests! The questions related to recursion and linked lists seemed easy and adorable in the class, but they suddenly became hard and seemed nonsense after I tried to solve them. I asked my friends and they told me they were in the past labs. 'What if there was a lab!', I complained. I had been extremely lazy so I didn't do the labs assigned during the strike.

During the test

Before finishing the past tests, I thought test 2 had been extremely simple because I finished 60-minute test 1 in 20 minutes and I got 90% several weeks ago. But I found it much more sophisticated in the past tests for test 2. Therefore my confidence decreased almost to 0. As a result, at the beginning of the test, I was stressful and did not know how to do the question. I forgot what 'traverse' means! Then I took a breath and asked the TA who was suppose to be on strike. Then I began tackling these questions. When the 60 minutes passed, I had much confidence.

After the test

I realized I should have done the labs and solved the problem remained in my mind on time. So I did the questions in the lab of week 9 by myself on 7-9 p.m., Thursday, the time that supposed to have a lab. I started to have problems. But there was no TA to help me! I didn't finish until 11:30. And some problems still remained in my mind. I then profoundly realized the importance of the lab and the TA. I hope the strike will end soon.

Sunday, March 15, 2015

Week 8: Frustrated About My Assignment 2

Assignment 2

The Weekend Before

The assignment 2 was due on Thurday night of the eighth week. I didn't officially start writing code until February 28th, the Saturday of the seventh week because I thought it was as easy as assignment 1. But the truth was completely the opposite: I spent the whole weekend on GameState. I was quite confused. How could it be integrated into GameView? And how to make it fit into minimax? These questions had hindered me for the whole weekend.

Monday and Tuesday

When I started on writing code for the strategy Minimax, I found that I even did not know how to start. So I even didn't sleep on Monday morning and became extreme worried. As a result, I even skipped CSC 148 and CSC 165 on Monday morning. Before I slept at 11 a.m., I figured out a helper function is required in Minimax. 
On Tuesday, I went to the office hour. One of the result was that I found out I misunderstood the structure of the game. I used to think that only one state was used in the entire game. Therefore I didn't what could be recursed on. Then I realize every step is a state. And when a new position is placed, a new state is generated which produces recursion. Therefore the mistery was solved.

Wednesday and Thursday

After I figured out what was going wrong, I began to rewrite everything, including GameState, GameView and everything else. 
And I checked the format by pep8 on Thursday.
Finally, I can have a nap safe and sound on Friday.

Monday, March 9, 2015

Week 7: Binary Tree and the Assignment

I decided not to go to the class this week because there would be two assignments due the next week: Assignment 2 for CSC148 and for CSC165. But my friends told me it is a bad habit to skip class even the deadline is approaching since then I don't know what is going on next. So I still learned something new:

Binary Tree

Binary tree is a tree that has only 2 branches: the left and the right. One or both can be None. If both are None, then it is a leaf. And itself is a datum.

Sample questions: how to find the depth of the tree?
We need to use recursion to go through every tree and use max() to compare the length of each node in order to get the greater one.

Binary Search Tree

Binary search tree is a tree that is used to search a set of data quickly. Since it is binary, it also contains only 2 branches: the left and the right. the left one is normally the smaller one while the right one is the greater one. This structure saves half of the time to find a number: if the number is greater than the datum, then it searches the right side of the subtree, or it is less, then it searches the left side. Definitely, if it is equal to the datum, then it is the number we need to find.

About the Assignment

It was much harder than I had expected. I thought it could be conquered in less than 24 hours, but the truth was, even after 48 hours, I was still struggling on the minimax: a game strategy that requires recursion.
So I decided to go to the office hour to ask the professor. He told me something basic yet important: Read the starter code! I had never read the starter code, and therefore it caused a problem when I used the help function. For example, I thought 'apply_move()' could work but it actually did nothing in my code. It didn't update the code automatically, which I expected. After a complete comprehension of the starter code, I changed it into: 'new_state = apply_move()' and I used the new_state to go though the next step. And then it works! It did the function that I expected. So in this lesson, I learn something new: Don't rush to start writing, read the instructions and the start code thoroughly instead.

Sunday, March 1, 2015

Week 7: Recursion: Fanciest Stuff I Have Seen

Week 7: Recursion

First Sight

I can still remember, the professor introduced the idea of 'recursion' several weeks ago. At that time, I thought it was a piece of cake. It reminded me a quite famous story from ancient China: "There was a temple in a mountain. In the temple there were two monks. The senior monk told a story to the junior monk: 'There was a temple in a mountain. In the temple there were two monks. The senior monk told a story to the junior monk: 'There was a temple in a mountain. In the temple there were two monks. The senior monk told a story to the junior monk: ...''". Yes, the story never ends. That's my first sight of recursion: something that repeats and repeats and therefore it never ends. But how is that different from 'while-loop'? Is that a 'while-loop' in a class?? These questions triggered me to keep on struggling on computer science.

Difficulty

'I should have prepared for the lab!', that was what I thought after the lab about recursion. Normally, I didn't need to preview for the contents of the lab. Still, I could comprehend most of the knowledge points hidden in the lab and get a 2/2 in the quiz . But it was the first time I could not finish all the questions in the lab! Even for the first question, I had struggled for a hour (Every lab is 2-hour long.). I only finished half of all the questions and I messed up the quiz! What a shame! I became frustrated and sometimes I even thought computer science was not suitable for me. But I am not the person that give up so easily.

Struggle

I began to listen carefully to every word that the professor was saying. I began to ask questions in the office hours and on Piazza. As a result, I began to comprehend the essence of the recursive functions: Functions that are using and are used by itself. And I found a 'trick' to write recursive functions:

if <first example>: # Usually it checks for the empty case.
    return <the type defined in the function>
else: # The second - last examples fit here.
    <use the function itself: where the recursion goes>
    return <the type defined in the function>

Maybe it is not a trick for somebody. It is simply a stardard format to write recursive functions. But it really helps me a lot.

Epilogue

I become more confident with recursion now. I could easily recognize how the recursion is hidden in the question though some questions still struggle me for a long time. I have boundless thoughts about recursion but I have to finish my assignment about recursions now!