Week 4 was a really busy week because assignment 1 was due on Thursday.At first, I can't figure out the difference between Game_view and Game_state. After attending Danny's office hour, I got it. Game_state is about the current state of the game, and Game_view is just to start the game.In lecture,we talked about recursion .If we use recursion we can generalize some arithmetic and simplify them.For example, if we want to get the sum of a list of lists without recursion (ie,[1,2,3,[4,5]]) , we should use two "for" loop, and the code could be complicated. If we want to get the sum of a list of lists of lists (ie, [1,[2,[3,4,5]]]), we should write another program using three "for" loop. However using recursion, all these things are the same!In the lab, there is a quite interesting question at the end of the handout, I post the docstring with my own code below which is different from my TA’s answer.
When it comes to trace a recursion. It is not a very hard problem
for me because I learned a bit of recursion in my high school. Prof. Diane
represented recursion on the black board carefully and clearly, so I got it.

No comments:
Post a Comment