Wednesday, December 5, 2012

Winding Down


Project #2 is finished now. Like the first project, completing it was a fairly rewarding task. For project 1, there was only 1 button to press but for project two there were multiple commands that you could input, using both the arrow keys and the mouse buttons. Before project 1, programming keys like this seemed pretty complicated, but once project 2 came around it wasn't that difficult at all. Practice with conditions in the past few weeks really helped with the completion of project 2.

I tried to work with someone else on the second project, but it didn't work for me. Seeing someone else try and solve the problems in ways that were different from how I would approach it made things slower. We spent a while trying to solve one of the problems for the project, and while we made some progress we didn't get very far. Once I got home and tried it on my own another day, I solved the problem really quickly. Having the same problem solving style seems to be fairly important for these projects. I wonder if this is true for other programming as well.

As the SLOG is due tonight, this will be my last entry. I have really enjoyed this course a lot, and I have learned a ton as well. I enjoyed programming the most. It has helped to give me a better understanding of what "code" is and all the things that it can do. It certainly comes up a lot in my every day life, so it is great to have a more thorough understanding of it. It also helps me better understand what my friends who are studying these things actually do with their time. I'm really glad that I got the chance to take this course.

Problem Solving!

One of the few requirements for this SLOG is that we document a problem solving episode of a "algorithmic, mathematical nature". I wanted to work on the paper folding problem since I had already given it some thought after the class discussion, but I was still having a hard time with it once I tried it at home. Instead, I went on the problem solving wiki that was provided to us, and chose a new problem from there. I settled on the Paper Slicing problem.

Understanding the problem

Given: number of straight lines
Required: number of regions

In this problem you are given a number that represents a number of straight lines. These lines theoretically divide up a piece of paper into several regions. The number of regions for 1, 2, and 3 lines were provided, and are listed below:

1 line = 2 regions
2 lines= 4 regions
3 lines = 7 regions

To better understand the problem, I created diagrams:



Creating the diagram with 3 lines helped me to realize that in order to create the most regions, the most existing regions must be intersected with the new line. 

Devising a Plan

Seeing the data in the form of a chart made it seem as though addition could be used to solve the problem. Previous problems like this that I had encountered suggested that a certain value added to the number of previous regions in order to find out the number of regions in the current state.

Carrying out the Plan

Using my addition plan I figured out what needed to be added to 2 (the number or regions created by 1 line) in order to arrive at the value 4 (the number of regions created by 2 lines). Clearly 2+2 = 4. I then saw if 4+2 = the number of regions created by 3 lines, but it was one value short. Clearly, adding 2 to the previous number of regions was not the solution to this problem. 

Looking Back

Clearly my first solution was not correct, but that didn't mean that addition wasn't the solution.

Devising a Second Plan

While executing my first plan, I realized that I was only off by 1 when using the +2 technique for 3 lines. This made me wonder if the value that I needed to add should increase each time a new line is added. This meant that I would +2, followed by +3 (2+1) for 3 lines.

Carrying our the Second Plan

1 line = 2 regions
2 lines = 2+2 = 4 regions
3 lines = 4+3 =7 regions

By increasing the number of regions added by 1 for every line I was able to solve the problem for a maximum of three lines.

Looking back

I wondered if my solution would apply if I had more data to work with. Having only 3 lines only gave me 2 opportunities to try my solution with. I decided that I needed one more opportunity before I would feel confident that I has solved the problem.

Devising a Third Plan

I was able to create a diagram with the maximum number of regions created by 4 lines:
I was able to create 11 regions with 4 lines. 

Carrying out the Third Plan

Now that I had a third piece of data, I tried out my formula again to see if my previous solution still worked.

1 line = 2 regions
2 lines = 2+2= 4 regions
3 lines = 4+3= 7 regions
4 lines = 7+4= 11 regions

Looking Back

My solution still worked with the new piece of data, and I was able to conclude that my solution was accurate.



Monday, November 19, 2012

Getting Into the Swing of Things

Project one is done now and I've started to work on project two. Starting this project is a lot less intimidating because I know what to expect this time around. I've done this once before and my strategies for completing the project have already been developed. For project 1, I found that if I was struggling with a certain definition, sticking with it and trying to figure it out for an extended period time didn't usually get me anywhere. Once I took a break and came back another day, the solution came to me much faster. A fresh start at a problem seems to bring a fresh perspective with it. Knowing this, as I start to get stuck on project 2, I will feel a lot more confident that if I step away for a while, I will be more likely to figure things out in the future, and will avoid frustration at the same time.

Another positive about both projects is that I am really eager to work on them. These projects are like puzzles, and I find myself looking forward to solving them. They are also so drastically different from the assignments I have in other courses (papers, studying for tests) that these projects are a nice break, and don't really seem like work. I get started on them fairly soon after the material is available for us to work on because it's more of a fun break from my other work. I don't view it as "work" and so I am more proactive in my completion of the assignment.

Since the semester will be coming to an end soon, I've been thinking more about the problem solving aspect that we need to include in our SLOGs. I've begun to work at the paper slicing problem that was presented to us on the problem solving wiki. My main concern at the moment is how I am supposed to present my problem solving on the SLOG itself. The handout said to consult the problem solving wiki for information on how to do this, but I found that the submissions didn't follow any standard layout. I am only mildly concerned about this however. If uncertain of what may be required, I tend to provide more information than necessary. It should make for a very detailed account of my problem solving episode. More to come!

Monday, November 5, 2012

Attacking Project #1

I've been working on Project #1 on and off for the past week. For this project we have been given a large amount of broken code, and we are required to fix it. Sometimes the definitions are incomplete, while other times the check-expect statements are missing. The end goal is to create a (funny looking) clock with a working second, minute, and hour hand.

I've completed 4 or 5 parts of the assignment and I have really been enjoying it so far. It has that problem solving aspect that I love. I had a hard time figuring out how to define clarify-image so I set it aside and came back to it this morning. After a little while longer, I figured it out. I had been making it so much harder than it actually was. I had forgotten that I could use map-image and had been trying to convert an image into its list of colours so that I could apply the function to each individual colour, and then turn it back into an image. I was surprisingly successful, except for when it came time to turn the list back into an image. Once I looked back through my notes and reminded myself of the variety of things that map can do, it was so much easier. Too easy in fact. I felt silly for trying to complicate things so much, but relieved that I had figured it out.

I'm getting into the more complex aspects of the assignment now. I am about to work on the set-clock function, which provides a new challenge because we have to define the function AND write a second check-expect statement. 

Part of why I like this assignment is because it is challenging, but once I figure it out it feels like a great accomplishment. I like solving problems on my own time, and proving to myself that I can do it. That being said, it is good to know that there are so many office hours available to us this week, just in case things start to pile up and I don't have an infinite amount of time to put into this assignment. It is really good to know that one of the TAs for this course works at the Help Desk three days a week, and that the prof understands that we typically wait until the last minute to do things, and has scheduled office hours on the due date with that in mind.  Lucky for me this is a project that I was excited to get started on, so I am hoping I will have it done early.

Monday, October 22, 2012

No Crow For Me

I was right to feel positive after I wrote the first term test, as I did quite well. When I told my parents how well I did they wondered if I had chosen the correct subject for my degree. Hopefully I can continue to do well, but the material is getting harder.

I haven't looked at the tutorial material for this week yet, but in lecture we looked at algorithms, and continued to work on our clock. I found the algorithm material a bit harder than previous material because it is such a broad topic. Since you can have an algorithm for almost anything (but not everything) I found that learning generally about them was difficult. The information wasn't concrete and saying that something was used to "solve a problem" was too broad for me to grasp. But once I inserted a problem on my own, like the paper-folding problem this made the material much easier to understand. I also found the example of the unsolvable algorithm quite interesting. I always find it interesting that bugs of that sort exist in our world.

Sunday, October 14, 2012

Term Test 1 Has Been Defeated!

I recently completed the first term test for the course and I feel so good about it! The way that this course is structured works perfectly for me and is really set out in a way that is going to help me do very well. I know that a lot of people hate quizzes that occur as frequently as ours, but I love them! They are never difficult, but simply knowing that they exist forces me to keep up with the material and study what we have learned from week to week. Since I study a little bit every week, it makes things a lot more manageable when it comes time to study for a test. Since I have already done the bulk of the work, some review about the history of computing, and reinforcing my understanding of how to do math in binary* was all I needed to do in order to prepare for the test. Normally if I hadn't studied and crammed my brain full of knowledge in the 24 hours leading up to the test I would have been FREAKING OUT, but not this time! This time I was well prepared and not stressed at all! All that being said, I don't have my mark yet so hopefully I won't have to eat crow upon receiving it.

Soon we will have to complete the second part of our Wikipedia assignment which involves learning the ways of the Wiki community. I'm not sure how I feel about this assignment yet in terms of how interested I am in completing it, but being an avid Wiki user I feel as though this assignment will certainly help me better appreciate the time and effort that complete strangers put in to helping me better understand the extremely complex genes and proteins I find myself investigating for other courses. For the most part I have chosen to help create better references in my chosen articles. Many a time I have been told by some academic authority not to trust anything I read on Wiki. I feel as though it doesn't have to be this way, and an easy way to fix that is by adding references. I would much rather use Wiki as a way of finding various scientific papers that I need to refer to than searching the U of T libraries website for hours on end. Anyway, a slight digression, but I am more than happy to contribute to a website that I greatly appreciate. Again, I am very fond of the way that this project has been broken down into three parts. It makes it much more manageable and keeps me on top of the things that I am doing. Perhaps I should be setting out a structure on my own for my other courses and projects...

* Math in binary is awesome! I loved learning this, though no matter how hard I wrack my brain I can't quite put a finger on why.

Wednesday, October 3, 2012

Making Programming Useful!

I'm really enjoying the things that we have been learning in the course so far. After the third lecture, we created a "clock". For the first time I can actually see how you would put the things we are learning to use in a game or on a website for example. At the beginning, I didn't really know why we would need to create a red circle in the program when we can also just copy and paste in images. But now that we can make things take action at certain times, and after the press of certain buttons, things are coming together.

I've just completed the tutorial exercise where we play around with big-bang, and making an action occur on the "tick". In lecture we didn't learn how to change the time interval that each tick represented. It was kind of fun to discover how to do this on my own. There were some things represented in the text (Picturing Programs) that were performed in a different way than we learned in lecture. The text makes an image rotate clockwise like this:
(on-tick rotate-cw)
In lecture we would change the rotation degree to a negative in order to make it rotate clockwise. While discrepancies like this were originally confusing, upon examining them further it was fairly enlightening to see that there are multiple ways to do the same thing. So far my impression of the programming world is that it is fairly strict, so seeing some flexibility here was refreshing.

The most difficult task presented to me in the exercises for tutorial 3 came when we had to alter the window size by adding additional arguments to (on-draw) rather than overlaying the image on a second image. This hadn't been discussed in lecture, so I searched the help desk for "on-draw" and it provided me with the following information:

(to-draw render-expr width-expr height-expr)

I wasn't really sure what "render" or "expr" meant, but I tried using this formula:

(on-draw render-expr width-100 height-100)

Eventually I figured out that "show-it" that we used previously may represent "render-expr" and that "width/height-expr" may represent numbers. So I tried one more time with:

(on-draw show-it 100 100)

I was finally successful! I'm pleased that I am slowly being able to problem solve my way through the world of programming. Part way through this exercise I was prepared to take this issue to my TA, so I am really happy that I was able to figure it out on my own. 

Things are starting to seem pretty complicated, and I am not sure how well I am going to retain the information. I'm very comfortable playing around with DrRacket and correcting things when I get an error message, but I am concerned about my ability to recall the things that I have been doing when it comes to the first test. That being said, there have only been three tutorials so far and since the test is next week, I feel confident that with enough practice I will do just fine!