The concept of ADTs has been comprehensively explored throughout this course. Our first big test on ADTs has been assignment 1 where we have to design generic codes for games, but does not specify specifically what game it is. The challenge that was faced by this is that we had to figure out what universal qualities existed across a variety of games, and should we express these qualities in the code. For my personal generic game codes, it was hard to figure what should be in GameStrategy, because, I couldn't fathom what is universal among all strategies other than who moves first, second, last, etc... One example of an ADT that we learned about was Stack, which is a ADT that stores things in a stack and removes the first item in it. We learned about the idea of it, and generic Stack functions were implemented in class. Although, anything more specific to a certain type of data would be subclassed, which is the entire point. If there were functions that must be implemented in the parents class but cannot, then we raise a not implemented error to tell future readers of our code that this should be implemented but could not for the parent class. This idea is like creating an open world that is customizable to anyone personally, but the basis of it should remain open so that anyone else could work with it just fine. Another ADT that we learned about was Trees, which is a fantastically cool idea. I think that the ability to access data at one point, and from that one point we can access more data, is the most interesting and practical. It reminds me of folder that has subfolders in them, so that we can find more information, but they are all stored in one giant parent folder so that we know where it is. The applications of it, such as the ability to do arithmetic in order of operations, is simple yet so helpful in our lives that people take it for granted. But really, it is those little things that affect our lives the most. I think though, that after doing many labs, I have gotten a better hang of the concept.
Recursion has been a tricky but useful concept. On one hand, it allows me to save code space, and it is certainly effective and allows for accessing data stored in a Tree-like data type, where we must access files within files. I think it is definitely fun to create recursion code. However, it is also tricky in the sense that I need to keep track of everything that goes on in the recursive executions to make sure the code works. For example, I could have a return statement that actually does not work because it returned the function inside a recursion process so in fact it did not return anything to the user, but if I don't have a return statement, how am I going to get it to return anything? That is the tricky part of it all! Well, I used my recursion skills to do A2, and it definitely was not easy at all ! It was hard to visualize all of the complications that could arise the the recursive process. I was quite disappointed with myself because I though I had the hang of recursion, but it is clear that the more steps are required in a recursion like the one we had to do for Minimax, the harder the recursion becomes.
No comments:
Post a Comment