2015年3月24日星期二

week10: The reflection of minimax strategy

     After we finishing the assignment 2, we will consider the reflection about the assignment 2. The core of the assignment 2 is the strategy of minimax. it is the new idea about the perfect strategy of computer. Unlike that the simple strategy depending the first square subtract game, the minimax strategy is the independent algorithm. It can apply to any games. It is calculate the every situation of the sum of winning probability for next step until the final step. And then, it chooses the best way to win the game of computer.
     During the assignment 2, we learn about the application and complete the code of  minimax strategy. After that, we should test the whether it is work and where we should improve. We should consider which data we can use to test the strategy is worked. For example,in the square subtract game, if we test the current number 10 all the next step is loss, and if we test the current number 11 all the next step is win. As the result, we can't get the information about whether the code of minimax strategy is worked.
      In addition, we should think about the shortage about the minimax strategy. For every step, we must consider the all step until the final situation of winning, which is too wasting time. And we should think about how simplify the strategy. It is our job in assignment 3.

2015年3月15日星期日

week9: impression of BST

In this week, the future class of BTNode is BST. The relationship between BTNode and BST is same as the LLNode and LinkedList. BST is built form many BTNode, but BST in not a list of BTNode instead of tuple type. In the other words, BST is an totally new class contains many BTNode in the class.
Many functions under the class also apply the thinking methods of BTNode class. For example,  the insert and delete function also use the recursion methods. I also respectively compare whether objects that insert or delete are greater or smaller than self.data and then compare information in the left and right children. In addition, BST has another statement,  self.root. As a result, when I insert or delete the value in BST, I need to add or minus one size in self.root and the other step is similar with BTNode.

2015年3月9日星期一

week8: impression of LinkedlistNode

This week, I have learnt a new class named LinkedlistNode, which is a little different from other class. It has more visual picture in their printing.  However, they also have some similar elements between LinkedlistNode and Tree or BTnode. the node.nxt in LinkedNode has the similar meaning like the children in Tree or Btnode. In the other hand, it has different method of calculation in function. For example, there are many recursion using in Tree and Btnode, because there can consider their children or left and right leaves to finish all situations in the class.
In the LinkedlistNode class, we use another method - while loop as the main idea in the function. For example, in the __add__function,  we us while loop and cur_node = cur_node.nxt to circulate the whole LinkedlistNode.  This is an other method of circulation.

2015年3月2日星期一

week7: Recursion

In the Week 7, we have learnt about the BTNode, which is similar with  class Tree. BTNode also have root and leaves. However, there is only two children with right and left instead of the many children. 
In many definition under the class BTNode, they need to apply to recursion in their code. We should consider the recursion of right and left children. For example, def list_longest_path(node) in class BTNode in lab06. We find the list_longest_path(node.left) and find the list_longest_path(node.right). Then, we compare the longer one between left and right children. Eventually, we can return the longest one in all these nodes. This is the traditional recursion.