In this week, our lecture mainly focus on 4 parts -- minimax strategy for our assignment 2, testing, making assertions, and function call stack.
For minimax strategy, our base case is to check after applying the move, whether the game is over or not. If it is over, we can use outcome method to get its opponent's score, otherwise, repeat applying move until we can get a final score. compared with methods provided by professor, ours uses the same ideas with a different code structure. Actually, this part has the most difficulty, it is the first time for us to use recursive method in a relative bigger task. With a correct thinking, hope we use recursion correctly.
For testing, in our lecture we also take assignment 2 for example. We learnt how to analyze test parameters, choosing test cases, and use methods setUp and
tearDown to reduce repeated code when we test the chosen cases.
We also discuss making the assumptions into assertions. if condition is not satisfied, raise
AssertionError.
At the end of the class, we discussed function call stack. From the knowledge of lecture, a call stack is a stack data structure that stores information about the active subroutines of a computer program, which is used for several related purposes, but the main reason for having one is to keep track of the point to which each active subroutine should return control when it finishes executing. An active subroutine is one that has been called but is yet to complete execution after which control should be handed back to the point of call.
Assignment 3 has been posted yet, maybe we will have a busy period of time to complete it.
No comments:
Post a Comment