it is in scope, but you generally don't need to know too much about it other than the fact that you can inherit methods from different parents
i think the mini lectures could have been a bit slower and we could have spent less time on the second problem.
honestly i agree yeah oops
Notes from last section
where were you on monday?
at a cubing competition
i went to vancouver the past weekend for canadian championships
i got pretty good results (load a video i guess)
In the Game Pokemon Mystery Dungeon, the is a useful item known as the Pass Scarf, which, at the expense of 2 hunger per pass, can pass off any physical attack. It tends to pass off to the physical attack to the lower right, so proper positioning of your partner Pokemon can lead to strategies built of reflecting damage. There is also a surprising variety of moves that can be passed off, though no thrown items are susceptible to this ability
meta moves in pmd are very different to regular pokemon
Temperature Check
Mutable Trees
Linked lists (Covered in today's lecture)
Trees
Trees (construction)
The Tree constructor takes in a label, and an optionallist of branches. If branches isn't given, it defaults to an empty list []
classTree:# simplified version compared to the 61A implementationdef__init__(self, label, branches = []):asserttype(branches) == listfor item in branches:
assertisinstance(item, Tree)
self.label = label
self.branches = branches
You can use linked lists to create your own version of a sequence
They are generally useful when you want to have an infinitely-sized list, or want to dynamically change the size of the list (more useful in 61B if you do end up taking it)
In general, linked lists problems can be solved using both iteration and recursion
Like trees, they are recursive data structures, but unlike trees, you can use both recursion and iteration to solve them.
Linked Lists (Anatomy)
classLink:
empty = ()
def__init__(self, first, rest = Link.empty):assert rest is Link.empty orisinstance(rest, Link)
self.first = first
self.rest = rest
Linked lists have a first (similar to label) attribute and a rest (similar-ish to branches) attribute.
Linked Lists (Construction)
Note to Anto: Draw box-and-pointer diagram
s = Link(1, Link(2, Link(3)))
>>> s.first
1>>> s.rest
Link(2, Link(3))
>>> s.rest.first
2
s2 = Link(1, 2) # This will error because rest is not a linked list>>> s.rest.rest.first
3