Throughout most of the course, writing out recursive functions for binary trees, has been the major hurdle for me. The lab that illustrated this most deeply was lab 6.
I was able to complete all he functions on lab 6, but after I did this I didn't feel like I had improved my skills in any sort of way. Most of the functions required multiple attempts for me to get them right, and by then I was merely using guess and check to tweak my functions until they worked. By the time they did work, I didn't have a very clear understanding of what actually was going on. The exam is in a few weeks so I'll have to keep on practicing these types of problems.
I didn't have any significant dilemmas understanding the other concepts we learned in class.
Outside of class work, stress was the another problem for me. I was told by a friend that this year, the cut-off limit for the CS specialist was being raised due to there being too many people applying to CS. I don't know what the new cut-off is, but it was enough to cause me a lot of unnecessary worry. In general, I do pretty well on my assignments and tests but I have a habit of over-thinking minor problems. This can sometimes cause me to burn out from the stress.
Even right now as I write this, there's a sense of worry gnawing away at the back of my head. Although I haven't been able to get rid of the stress completely, I was able to find ways to placate it. For one, I found that scheduling my days and weeks works very well to lowering my levels of stress. I think that if I feel like I have greater control over my life, I will be less stressed overall.
Overall, this semester was a very interesting semester. I'm getting kind of tired right now, so I'll end it here until I think of more stuff to write.
Suffering from Writer's Block
Friday, 3 April 2015
Slog #9, Looking back at Past Slogs
So it's been about a few weeks, and class is almost over so I guess it's time for me to look back over a past SLOG post.
I guess I don't have much of a choice as to which SLOG post I should choose. The only SLOG post that isn't a CS diary entry is basically my first one on why geeks should learn to write. As a result, to fill this SLOG post up, I'll look over my first SLOG and compare my opinions then to my opinions now.
To be honest, I still largely agree with what I wrote initially, except I do admit that I made too many grand generalizations. I don't think I can be blamed too harshly, since I suffer perpetually from writer's block. Regardless, back to the topic.
Over the last few weeks I met many people who were geeks (likes video games, CS students, generalizing again), but who were also very good at expressing themselves. I'm actually a little bit jealous of people like this since expressing myself clearly is a problem I have at times.
Anyways, getting back to the point, I think geeks should still learn to write, but I no longer believe that geeks are generally bad at expressing themselves through speech.
Comparing my own experience in these SLOGs to other people's experiences is very difficult since at least half the class doesn't seem to write them. There are a few well-organized and dedicated students who regularly write these entries but I have a feeling that their experiences don't represent the experiences of the rest of the class. I don't want to sound elitist, but I think most of these SLOG posts I have read are pretty generic - what you would normally expect tired, stressed students (like me) to write at midnight.
The one true benefit I got from writing these posts, is that they gave me clarity of what I had done in CSC148 and helped me schedule what to do next. When my thoughts were on paper (or on the computer), I also felt a little bit of relief and less stressed.
I guess I don't have much of a choice as to which SLOG post I should choose. The only SLOG post that isn't a CS diary entry is basically my first one on why geeks should learn to write. As a result, to fill this SLOG post up, I'll look over my first SLOG and compare my opinions then to my opinions now.
To be honest, I still largely agree with what I wrote initially, except I do admit that I made too many grand generalizations. I don't think I can be blamed too harshly, since I suffer perpetually from writer's block. Regardless, back to the topic.
Over the last few weeks I met many people who were geeks (likes video games, CS students, generalizing again), but who were also very good at expressing themselves. I'm actually a little bit jealous of people like this since expressing myself clearly is a problem I have at times.
Anyways, getting back to the point, I think geeks should still learn to write, but I no longer believe that geeks are generally bad at expressing themselves through speech.
Comparing my own experience in these SLOGs to other people's experiences is very difficult since at least half the class doesn't seem to write them. There are a few well-organized and dedicated students who regularly write these entries but I have a feeling that their experiences don't represent the experiences of the rest of the class. I don't want to sound elitist, but I think most of these SLOG posts I have read are pretty generic - what you would normally expect tired, stressed students (like me) to write at midnight.
The one true benefit I got from writing these posts, is that they gave me clarity of what I had done in CSC148 and helped me schedule what to do next. When my thoughts were on paper (or on the computer), I also felt a little bit of relief and less stressed.
Slog #8
I can't believe I spent that much time studying for that test. On the Monday and Tuesday right before test 2, I must have spent at least 4 hours each day. The only thing I did for those two days was review labs.
Some of these labs questions are really difficult, especially recursive functions like list_internal_between. If any of these labs appear on the test I would be screwed. Since I didn't have much time left, I copied the answers to every single lab onto my cheat sheet. God bless, without a cheat sheet I would not be passing this test.
### After Test 2
So after the test, I came to the conclusion that test questions will be almost the same as lab questions. Only one question in the test was actually hard and that question was (if i can remember the name). to write the function list_even_between. This was exactly the same as a lab question I wrote down on my cheat sheet.
I can't believe how lucky I was on this test. To be honest, if I didn't write this function on my cheat sheet, I would not have been able to answer that question.
In addition, I wrote down the definitions for post-order, in-order and pre-order tree traversal on my cheat sheet. This too turned out to save me a few marks. Other than that, I had no problems during the test.
### In Class
In the last week, we spent some time working on testing and we also looked over this problem:
N = 5
M = 2
def f(N):
return M * g(N + 1)
def g(N):
return M * N
def h(N):
return f(g(N))
I'm still not fully sure how this problem works. I'll do some asking to understand it.
Some of these labs questions are really difficult, especially recursive functions like list_internal_between. If any of these labs appear on the test I would be screwed. Since I didn't have much time left, I copied the answers to every single lab onto my cheat sheet. God bless, without a cheat sheet I would not be passing this test.
### After Test 2
So after the test, I came to the conclusion that test questions will be almost the same as lab questions. Only one question in the test was actually hard and that question was (if i can remember the name). to write the function list_even_between. This was exactly the same as a lab question I wrote down on my cheat sheet.
I can't believe how lucky I was on this test. To be honest, if I didn't write this function on my cheat sheet, I would not have been able to answer that question.
In addition, I wrote down the definitions for post-order, in-order and pre-order tree traversal on my cheat sheet. This too turned out to save me a few marks. Other than that, I had no problems during the test.
### In Class
In the last week, we spent some time working on testing and we also looked over this problem:
N = 5
M = 2
def f(N):
return M * g(N + 1)
def g(N):
return M * N
def h(N):
return f(g(N))
Monday, 30 March 2015
Slog #7
So this week, I found out that I had done my minimax function completely wrong the day before it was due. My understanding of minimax was wrong the entire time.
I thought Minimax was a type of strategy where the computer would calculate every possible game state that can result from a move and then return the chance of winning for that move.
So for example, let's say that the computer can make 3 possible moves. Minimax would go through each of these moves and find every possible final game state. It would then find the "average" of all these final states and rate each of these three moves based on the percentage of win states to total states.
So minimax might end up generating something like this:
Move 1: (40% win chance)
Move 2: (70% win chance)
Move 3: (80% win chance)
Based upon my minimax, the computer would choose move 3.
The fundamental error here is that I assume that my computer is going up against an imperfect opponent. A real minimax is supposed to assume that the computer is facing a flawless opponent.
Knowing that I had such a huge problem in my program, I had to pull an all nighter to finish minimax.
By a miracle, it turns out that all the information I ever needed on minimax was on wikipedia. There was nothing to stress over the entire time.
http://en.wikipedia.org/wiki/Minimax
There was more than enough information for Minimax, Not only that, there was even pseudocode for minimax. With this much useful info, I finished minimax in 2 hours.
In addition to finishing minimax I also reviewed a few of the past labs for recursion. I found some of the recursion problems, (especially for binary lists) to be very hard. Not so difficult that I couldn't solve them with enough time but difficult enough that they can stump me for a while. I am going to have to practice these problems alot if I want to succeed on the test.
I thought Minimax was a type of strategy where the computer would calculate every possible game state that can result from a move and then return the chance of winning for that move.
So for example, let's say that the computer can make 3 possible moves. Minimax would go through each of these moves and find every possible final game state. It would then find the "average" of all these final states and rate each of these three moves based on the percentage of win states to total states.
So minimax might end up generating something like this:
Move 1: (40% win chance)
Move 2: (70% win chance)
Move 3: (80% win chance)
Based upon my minimax, the computer would choose move 3.
The fundamental error here is that I assume that my computer is going up against an imperfect opponent. A real minimax is supposed to assume that the computer is facing a flawless opponent.
Knowing that I had such a huge problem in my program, I had to pull an all nighter to finish minimax.
By a miracle, it turns out that all the information I ever needed on minimax was on wikipedia. There was nothing to stress over the entire time.
http://en.wikipedia.org/wiki/Minimax
There was more than enough information for Minimax, Not only that, there was even pseudocode for minimax. With this much useful info, I finished minimax in 2 hours.
In addition to finishing minimax I also reviewed a few of the past labs for recursion. I found some of the recursion problems, (especially for binary lists) to be very hard. Not so difficult that I couldn't solve them with enough time but difficult enough that they can stump me for a while. I am going to have to practice these problems alot if I want to succeed on the test.
Slog #6
I spent most of the week working on assignment 2 and I was met with quite a few significant problems. The first problem I had was with the minimax function.
For some apparent reason, whenever I attempted to run minimax with Tippy, the minimax class would always crash midway. I did what I normally do in the event of an error, I filled my minimax class with print functions so that I can track different values in the minimax class.
So I went and tracked what happens in minimax when I run Tippy with a 3x3 board. What I found was incredibly confusing. For some reason, every time I ran the AI, minimax would load through only 9 different game states and then crash.
And for some reason, the last game state would always look like this:
[X,O,X]
[O,X,O]
[X,O,X]
I spent the next hour trying to find the problem and I still had no clue what was going on so I decided to sleep on it.
After some thinking I finally realized what was going on. In every one of my Tippy game states, I had a two-dimensional grid ([][]) that corresponds to my grid. Every time I made a move I would add an X or an O on an empty spot in the grid and then I would return the new corresponding game state. The problem here was that 2D arrays were mutable and as a result, my initial game state (which is supposed to remain an empty board) was consistently being changed every time minimax was called.
This perfectly explained why my minimax would crash after printing 9 states. This is because after going through 9 states, my initial state was already full and minimax could not find any more moves to make.
This problem was very interesting for me because I made use of knowledge about mutability I had learned in CSC108. Solving this problem also made me feel like I had done something substantial.
So I went and tracked what happens in minimax when I run Tippy with a 3x3 board. What I found was incredibly confusing. For some reason, every time I ran the AI, minimax would load through only 9 different game states and then crash.
And for some reason, the last game state would always look like this:
[X,O,X]
[O,X,O]
[X,O,X]
I spent the next hour trying to find the problem and I still had no clue what was going on so I decided to sleep on it.
After some thinking I finally realized what was going on. In every one of my Tippy game states, I had a two-dimensional grid ([][]) that corresponds to my grid. Every time I made a move I would add an X or an O on an empty spot in the grid and then I would return the new corresponding game state. The problem here was that 2D arrays were mutable and as a result, my initial game state (which is supposed to remain an empty board) was consistently being changed every time minimax was called.
This perfectly explained why my minimax would crash after printing 9 states. This is because after going through 9 states, my initial state was already full and minimax could not find any more moves to make.
This problem was very interesting for me because I made use of knowledge about mutability I had learned in CSC108. Solving this problem also made me feel like I had done something substantial.
Sunday, 1 March 2015
Slog #5
Please grade my summary of objected oriented programming this week.
I'll update this post once I'm done documenting Assignment 2.
I'll update this post once I'm done documenting Assignment 2.
Saturday, 21 February 2015
Object Oriented Programming, Slog #4
Object Oriented Programming, starts off with the concept of
classes and objects. An object is something that can perform a set of
actions/methods. A class is a blueprint of an object. For example, we can have
a blueprint of a plane like the following:
Blueprint of a plane:
-
Wings
-
Cockpit
-
Fuel Tank
-
Instructions on how to combine parts to build
plane
-
Etc
Now let us imagine that we have an actual plane. So now we
have a blueprint of a plane and an actual plane. The blueprint of a plane is a
class, while the actual plane is an object. We say that the real plane is an instance of the plane blueprint. Technically,
objects and instances are the exact same thing, but we usually use the word
instance to describe an object that is of a class.
Let’s say that we have two classes. One class is the plane
blueprint class from above. Another class is blueprint for a fighter jet we have
here:
Fighter Jet:
-
Missiles
-
Guns
-
Wings
-
Cockpit
-
Fuel Tank
-
Instructions on how to build fighter jet
-
Etc
Fighter jets are a subset of planes. Fighter jets are
planes. Also notice how Wings, Cockpit
and Fuel Tank are all shared by Fighter Jets and planes. We can say that
fighter jet is a class that inherits from class plane. So next time we can write a blueprint of a fighter jet like this:
Fighter Jet(Plane):
- Guns Missiles
- Instructions on how to build a fighter jet
- Etc
Fighter Jet(Plane):
- Guns Missiles
- Instructions on how to build a fighter jet
- Etc
One last thing to mention is that classes also have methods. On the fighter jet class, we have instructions on how to build a fighter jet. This is an initializer method (__init__) that is called whenever we want to create a fighter jet object. In addition to this method, we can also add methods such as 'Fire Missiles' or 'Fly', that allows this fighter jet object to interact with itself and with other objects.
So after doing some tweaking we have a final Fighter Jet class:
Fighet Jet(Plane)
- Guns Missiles
- Instructions on how to build a fighter jet
- Fire Missiles (This is a method)
- Fly (This is a method)
Why did people invent object oriented programming?
I’m not an incredibly experienced programmer, so I can’t
really give an expert opinion. However, my guess is that objected oriented
languages are much more efficient for the programmer. After all, with OOP, the
programmer doesn’t have to repetitively write out the same code over and over
again (e.g he doesn’t have to keep on rewriting a plane blueprint) when he can
just initialize a single object and all the code is automatically done for him.
http://antiaromatic.blogspot.ca/2015/02/lab-5-work.html?showComment=1425265486615#c6709566295146482820
A slog that I commented on. Very helpful info on Lab 5.
http://antiaromatic.blogspot.ca/2015/02/lab-5-work.html?showComment=1425265486615#c6709566295146482820
A slog that I commented on. Very helpful info on Lab 5.
Subscribe to:
Posts (Atom)