Now that the semester is over i finally have time to look back and reflect on the course. I still remember the first day of class, Danny talked about all the things we would cover in this course and i was definitely looking forward to it. I was extremely happy when he said we would be learning game AI. That is something i was especially interested in and if i decide to specialize is CS, AI would be my focus. Little did i know how difficult it was to program game AI. Minimax had given me and my partner more trouble than we would like to admit.
Anyways now the strike is finally over and we have had some changes to the syllabus. Only the quizzes we've done will be marked and they'll be skewed so they account for 10% of our grade. I found this change fair however a lot of people didn't seem to like it because they started off the course with low marks in the quizzes.
Assignment 3 was finally finished and this time me and my partner learned from our previous mistake of not starting A2 on time and we started exceptionally early on it. We finished a week in advance and spent that entire week going through our code making sure that we didnt mess anything up. Both of us were extremely happy with the final product.
The course is over now and i will definitely miss it, i really enjoyed the material we learned and i looked forward to every lecture, the assignments and tests were difficult but to the point where if you spent an adequate amount of time studying you shouldn't have a problem acing them. Unfortunately i realized this a little late but was able to fix my mistakes and learn from them. Really looking forward to see what the upper year CS courses have to offer.
Tuesday, 7 April 2015
Week 11: Revisiting an Earlier SLOG
The SLOG i am revisiting is the one i made on what Assignment 1 had taught me. Although i didn't really go into much detail I still stand by what i said before. After doing A1 i was a lot more comfortable with inheritance and recursion and this helped me a lot during the second half of the course. We used recursion for the majority of the second half of the course since we were introduced to Abstract Data Types, and the best way to traverse them is to use recursion.
Trees for example, anything related to traversing or accessing things stored in trees required recursion, without the knowledge i gained from A1 i would have been completely lost. Even in A2, although me and my partner were unable to figure out how to Minimax, a large majority of the functions required recursion to finish and we wouldn't have been able to do it without the knowledge we gained.
Overall i felt like A1 was a great stepping stone into the more advanced material that we learned later on in the course and without it, my success would have been limited.
Trees for example, anything related to traversing or accessing things stored in trees required recursion, without the knowledge i gained from A1 i would have been completely lost. Even in A2, although me and my partner were unable to figure out how to Minimax, a large majority of the functions required recursion to finish and we wouldn't have been able to do it without the knowledge we gained.
Overall i felt like A1 was a great stepping stone into the more advanced material that we learned later on in the course and without it, my success would have been limited.
Week 10: Impressions of Week 9
This week was test 2 week. I spent a decent amount of time studying for this course but not as much as i would have liked to. I'm sure this will bite back when getting my marks back. Anyways i reviewed the lecture slides, looked over all the programs that Danny had used in conjunction with the lecture slides and me and my assignment partner had made a cheat sheet together to use for the test. This came very handy.
The first part of question 1 was a piece of cake as it dealt with building trees with a certain arity. The second part is where things started to go wrong. It asked me to traverse the tree using post-order traversal, i had remembered looking over the definition while reviewing the lecture slides however i blanked out during the test and had no idea how to do it.
For question 2 i was extremely lucky, we had to write a function called list_leaves_between and it just happened to be one of the functions that me and my partner had included in our cheat sheet, so all i had to do was change up the variables to match the ones on the test and that was done. On to the last one.
This question i found extremely difficult, i spent the majority of the test time just working through this. It had to do with linked lists and manipulating the front and back of them. Although i was familiar how linked lists worked, i had never actually worked with them in code so i was in a bit of trouble here. However after careful planning i had come up with some code that looked good to me and i handed in my test and left. I definitely wasn't happy with how this test turned out and it was entirely my fault. However i learned form my mistakes and definitely won't let this happen again during the final exam
The first part of question 1 was a piece of cake as it dealt with building trees with a certain arity. The second part is where things started to go wrong. It asked me to traverse the tree using post-order traversal, i had remembered looking over the definition while reviewing the lecture slides however i blanked out during the test and had no idea how to do it.
For question 2 i was extremely lucky, we had to write a function called list_leaves_between and it just happened to be one of the functions that me and my partner had included in our cheat sheet, so all i had to do was change up the variables to match the ones on the test and that was done. On to the last one.
This question i found extremely difficult, i spent the majority of the test time just working through this. It had to do with linked lists and manipulating the front and back of them. Although i was familiar how linked lists worked, i had never actually worked with them in code so i was in a bit of trouble here. However after careful planning i had come up with some code that looked good to me and i handed in my test and left. I definitely wasn't happy with how this test turned out and it was entirely my fault. However i learned form my mistakes and definitely won't let this happen again during the final exam
Week 9: Impressions of Week 8
This week Assignment 2 was due. Me and my partner were working on it right up until when it was due at 11:59 pm on March 5th. We kept going at it on the Minimax problem however we were unable to figure out what to do. It seemed easy to implement since we had worked out the basics. However the code that accomplished the task eluded us, we were very stressed out trying very hard to finish it on time however we just weren't able to. We believe we didn't give ourselves enough time to finish the assignment so we decided for A3 we would give ourselves at least 2 weeks to finish it
In lecture we covered LinkedLists, Now this is a concept i had previously covered in grade 12 while working in java but i was still a little rusty on it and i never really fully understood how to implement it. A LinkedList Node (LLNode) has an instance variable that stores the value of the node and another instance variable that points to the next node.
We also learned to make a wrapper class which is used to store information about the LL. It stores information like the front and back of the LL and the size of it. To traverse a list we were thought to use a while loop. We would make a variable that stores the current_node by setting it to self.front and then in the while loop, under some condition, it would do something and then set the current node to current_node.front, causing it to look at the next node.
In lecture we covered LinkedLists, Now this is a concept i had previously covered in grade 12 while working in java but i was still a little rusty on it and i never really fully understood how to implement it. A LinkedList Node (LLNode) has an instance variable that stores the value of the node and another instance variable that points to the next node.
We also learned to make a wrapper class which is used to store information about the LL. It stores information like the front and back of the LL and the size of it. To traverse a list we were thought to use a while loop. We would make a variable that stores the current_node by setting it to self.front and then in the while loop, under some condition, it would do something and then set the current node to current_node.front, causing it to look at the next node.
Week 8: Impressions of week 7
Week 7 is assignment 2 week. Me and my partner have spent hours working on the assignment and made significant progress however we reached a standstill when confronted with minimax. We had a lot of trouble grasping the concepts behind it. After a lot of drawing and brainstorming we were able to picture how it carries out its commands through recursion. It takes a GameState, looks at all possible moves that can be made from that GameState, applies those moves to the current GameState and then returns the new GameStates that resulted from those moves. Now it just needed to do this until it reaches the end game.
Now at this point we were feeling pretty confident, however now came the tougher part of implementing the method. We tried many things but no matter what we did we would either get an infinite recursion or the incorrect output. We had a lot of trouble trying to figure out the base case, we spent a good part of the week working on Minimax however we weren't able to figure it out just yet so we decided to let it go for now and come back to it a little later.
In this weeks lecture we covered Binary Expression Trees. These are trees where parent nodes are arithmetic operators (+,-,* and /) and the leaves of the trees were data values. We learned how to evaluate them as well. Using recursion, the base case is if the tree is just a leaf, in that case we would just return the value of the node. If it is a normal tree, then you visit the left node of the parent to get the first value, then you visit the parent node to get the operator and then you visit the right node.
Now at this point we were feeling pretty confident, however now came the tougher part of implementing the method. We tried many things but no matter what we did we would either get an infinite recursion or the incorrect output. We had a lot of trouble trying to figure out the base case, we spent a good part of the week working on Minimax however we weren't able to figure it out just yet so we decided to let it go for now and come back to it a little later.
In this weeks lecture we covered Binary Expression Trees. These are trees where parent nodes are arithmetic operators (+,-,* and /) and the leaves of the trees were data values. We learned how to evaluate them as well. Using recursion, the base case is if the tree is just a leaf, in that case we would just return the value of the node. If it is a normal tree, then you visit the left node of the parent to get the first value, then you visit the parent node to get the operator and then you visit the right node.
Another concept related to Trees we covered were Binary Search Trees(BST). BST's are a tree data structure where the values of the nodes are sorted. This is where the left node of the tree has a value lower than the parent and the right node of the tree has a value greater than the parent.
Overall i found the concepts generally interesting. It showed us the many uses of Abstract Data Structures (ADT's) which i originally thought were useless. However after Danny showed us actual applications i felt it was a lot more interesting.
Overall i found the concepts generally interesting. It showed us the many uses of Abstract Data Structures (ADT's) which i originally thought were useless. However after Danny showed us actual applications i felt it was a lot more interesting.
Sunday, 22 February 2015
Summary of Object Oriented Programming (Please mark)
Object oriented programming is a fascinating concept. It opens the door to allow you to do many abstract things with python. I first realized this while working on the Subtract Square game for assignment 1. Object oriented programming focuses on using classes to make objects that are used to store data. For example in assignment 1, we made a class for GameState(GS). This was a general class that was used to keep track of a general game. It had different instance variables which are variables of the class to store information about the class. This general class stored information like whether or not it was the computers move, a list of available moves and whether or not the game is over. Now most of this information is useless without knowing information from a specific game since you wouldn't know when to update these variables.
So this is where the game specific classes come into play. We made a SubtractSquareGameState (SSGS) class. This class in conjunction with the general GS class completes the game. While initializing the SSGS class we inherited the GS class. So we automatically get the variables in the GS class. So we are able to update the variables from the GS class in the SSGS class because we now know specific information about the game. This assignment gave me a great understanding of how useful inheritance and Object Oriented Programming is. This entire game could have easily been done without the use of objects however doing it this way allows you to make multiple similar games since the groundwork for the game is already laid out in the general class. You would just need to program the specific code for the game you need to add. Where as if you were to do it without objects you would have lots of duplicate code.
So this is where the game specific classes come into play. We made a SubtractSquareGameState (SSGS) class. This class in conjunction with the general GS class completes the game. While initializing the SSGS class we inherited the GS class. So we automatically get the variables in the GS class. So we are able to update the variables from the GS class in the SSGS class because we now know specific information about the game. This assignment gave me a great understanding of how useful inheritance and Object Oriented Programming is. This entire game could have easily been done without the use of objects however doing it this way allows you to make multiple similar games since the groundwork for the game is already laid out in the general class. You would just need to program the specific code for the game you need to add. Where as if you were to do it without objects you would have lots of duplicate code.
Sunday, 8 February 2015
Impressions of tracing recursion
Tracing code for recursive functions is a very fun thing to do. It's almost like you're working with nesting dolls or peeling layers off of an onion. You pass the argument through the function which refines it a little and passes it again through the function until eventually it hits a stopping point and is able to connect everything together. Tracing it allows you to see how the computer analyzes the function calls. Each call of the function is like another layer being unraveled to try and understand the thing as a whole.
Monday, 2 February 2015
What assignment 1 had taught me
Assignment has taught me a lot of things about programming that I was just never comfortable with before. In my final year of high school I briefly covered classes and objects however I couldn't think of any practical applications for it and I had trouble understanding what was going on. However now that i have completed and submitted assignment I have a very clear understanding of the various concepts associated with classes and objects. Thinks like overriding functions and inheriting classes that were once a mystery to me are now something that I believe I could incorporate in future projects with relative ease.
Monday, 26 January 2015
Why geeks should write
Why writing skills are important:
Writing is a very important tool for programmers, although most beginner programmers tend to work on projects by themselves, when it comes to working in groups its crucial to be able to explain your code. Whether it be if your partner asks for clarification or it's writing comments, if no one can understand your code its pretty much useless. These writing skills can also be used to keep a journal of your progress through a project. Often times if you are stuck on a problem and you try writing it out the solution comes clear. Writing out the problem requires you to know what you are doing in each step of the code and it allows you to pinpoint where the problem might be occurring in a way that staring at a wall of code just cannot do. Not only that but if you can document the steps you took to fixing a bug, it can help you understand it better and once you do fix it you can refer back to it if you ever run into the same bug. These are just some of the many reasons that writing is an essential tool for programmers.
Subscribe to:
Posts (Atom)