I lied, we return to crazy binary search trees next week. This week we talk about linked lists (and bemoan the challenges of assignment 2). Linked lists have a recursive structure like trees which is kind of neat. That means we can perform similar techniques on them such as seeing if any of the linked lists contain a certain values. The other neat thing that I remembered from lectures is that when you are writing class methods such as "__contains__" and " __setitem__" can be called with "in" and "l[0]" respectively. The implications for that are pretty cool. For any class we define, we can add in __contains__ and __setitem__ just like we would __str__ or __repr__ and get some basic python functionality for our objects.
Assignment 2 was tricky. In hindsight, I think I should've worked with a partner. There was a lot of room for error in the assignment, and I think it would have been helpful to have another set of eyeballs evaluating my code. We were also given a bit more independence for this assignment in terms of how we solved problems. For instance, we know we needed a way of storing the information on the tippy board, but we weren't explicitly told to make a dictionary, list structure, or some custom coordinate system thing. There were some neat learning opportunities here because my original data structure (a single list) only worked for a 3x3 board size. In order to get an nxn board working, I needed to change the structure (lists within lists). Because I changed the structure, I had to change how game checked for a tippy.
Minimax was a bit laborious. On my own, I could write a function that could evaluate the score of a move for me, but it only worked properly if a win was two moves away. When I finally read the instructions on piazza (which were virtually identical to what Danny had said in class, but were even more explicit) I figured it out on my commute into school. I originally wrote minimax for subtracts quare, so adapting it to tippy was surprisingly trickier. Ultimately, there was more to do on this assignment than I expected, and another partner working with me probably would've helped.
No comments:
Post a Comment