Saturday, 4 April 2015

Post 7
This was the second midterm exam week. The second midterm I felt was a lot better than the first one. The first question was quite simple, since it mainly involved simply traversing through a tree in pre-order format and make very simple Binary trees. The second question was also quite simple and was one where the aid sheet helped. I had the list_between method written down and the question asked for list_even_between which only required a minor adjustment to the original code. The last question was kind of tricky, since I was not completely comfortable with LinkedLists. Logically, my code made sense, however, the syntactic component was one I was not too comfortable with.

This week, we learned about unit testing and assertions. I forgot to talk about the assignment in the last post so I will mention it now. Completing this assignment was one of the best learning experiences I have had not only in this course but in all of first - year. Being able to understand an algorithm that seemed complex was extremely gratifying. The previous labs and large emphasis the course seemed to have on recursion was very helpful when coding the minimax algorithm. This weeks assertions and unit testing unit was mainly focussed on the assignment.  Diane showed us her version of minimax and ran it through some unit tests to see if it worked for a few cases. She showed that there was a very small chance that the game would win all the cases randomly so if it passed the unit test, it was probably right. We also learned about what kinds of cases were best for the unit test. For example, in Subtract Squares, 3 would be a very bad case since there is only one possible move.

We also looked at assertions, which were useful tools in unit testing. The user could assert a statement, using the proper syntax of course, and the program would raise an error if the assertion wasn't True.

No comments:

Post a Comment