Monday, April 6, 2015

Last impression about this course

Looking over this course, it is different from a pure programming teaching course which focus on grammar and programming technique. Instead, it focus more on programming thinking. Most of the time, we are not learning how to write code, but how to solve, how to arrange the structure of the program. I remember there was a impressed demo. Professor Heap wanted to explain how binary tree search work. He asked all of the students to be one on the node, and each line of student represent a level in the tree. He as the root of the tree asked question to his sons which are the first lines of the student, and the first line asked next line until someone found the answer. This demo clearly explained how binary search tree works and demonstrates how efficient it is.

Another important concept I learned in this course is recursion. If we want to solve a problem, we can divide it into smaller problems and combine them together to solve a bigger problem. The easy-to-code nature of python provide a easy to understand and easy to design structure of recursion. Since we can use a list to contains the result of previous recursions, we can simply use + to combine these results. For example, we search a binary tree, we can put all the number by calling left subtree into a list, and put all the number by calling right subtree into another list. Now we have all the values in the tree in a single list and we can find the value of the tree easily. 

Wednesday, April 1, 2015

revisit topic about why geeks should write

Why geeks should write is a topic that raised very early this semester. I remember in my previous blog, I recall the experience I have for programming and try to combine that with writing blog. I briefly mentioned that writing a blog is important and convenient for us to record bugs we made. After several weeks' study, I have something new to say about it.

In terms of the language geeks (properly us) use, these languages are mostly machine based language. It might be easy to read for experienced programmer, but for most of the people, machine language is not friendly and easy to understand. Geeks need a platform to communicate. The content of the platform should not just limit to codes.  We want to share information that can be understood by most of the people, because the idea behind a problem is much more important than the language itself. For example, some computer science professor who is studying computing theory might not familiar with practical language but their programming design ability should not be ignored. If geeks can write normal language and share their idea in a blog, that means it open a door to communicate with a whole bunch of people such as theory professor who might not familiar with codes.

Impression about week 7

This week, we finish assignment 2 which is a interesting game computation design. Actually, I did bad at Assignment 1 because I did not realize that this game design is a objected-oriented design. What I mean for the objected-oriented is basically the design frame of this assignment should be applied to any other similar games. For example, we have a general game state function which contains general game states and function such as whose turn it is, which move this player chose. What we write for this general function should not design for a particular game state, meaning, we should not use any parameter and function from a particular game class. The reason we do this is to build a frame of all the game so that every time we build a new game, we just follow this frame and design a subclass under this total class. This is quite useful and time saving in a real life design project.

Fortunately,  I don't need to use my messy Assignment 1 to do the Assignment 2. In this assignment, we have a different object which is to build a new strategy - minimax. General idea of this strategy is simply, whatever is good for the opponent is a bad thing for me. It is kind of like game theorem that every move before choosing the move, we have to compare each legal move so that we can get a move that benefits us mostly. To do this, algorithm minimax is a recursive function that kind of computes each move alternatively starting from current player, and return the best move. With this algorithm, we can get a move that relatively good.