My Experience with CS50’s Week 0 and 1 and Its Problem Sets
Do you remember an experience in where you have to do something a bit tricky (or at least, cryptic) and you were able to solve it? Do you remember the feeling of joy (and adrenaline?) flowing from the crown of your head down to the soles of your feet? Do you miss it? Try HarvardX: CS50 Introduction to Computer Science and its problem sets.
For a week now, I have been diving in the program and I am really enjoying it! I just finished the lecture and problem set of Week 1. The experience of it, especially after solving the problem set was really awesome! (Note: If you want to view directly about my experience with the problem sets and how I dealt with it, you can skip and scroll directly below.)
Before elaborating though, I would like to mention that there is something called a Week 0 in the program where you would be introduced to the world of computer science and to a program called Scratch. It is a “free education programming language” that could be used by beginners to at least understand some of the basic concepts. Here is Scratch’s description for more details:
Every week from CS50 has a lecture, shorts and a sproblem set. Lecture features a video of a guy named David Malan, a professor from Harvard, teaching in a classroom setting. Shorts are kind of additional resources (in a video format) where some CS50 staff teach. Problem sets are assignments that check and reinforce your learning of the current week. (Note: They are not that easy, which makes them really enjoyable and worthwhile.)
Week 0 Problem Set
For week 0, the problem set was to create and implement a project of your own making. It can be an animation, game, interactive art or anything else. It sounds easy but it has plenty of requirements which ranges from having 2 sprites (or something like a character) to having at least one sound.
It actually took me around 5 hours to complete such task! At first, I thought it would only took me around 2–3 hours but then, I was wrong. Making it work takes more time than I initially thought. My idea was to make a game similar to Flappy Bird yet with a dragon. I wanted it to just be a simple game but also having fun features like a score and cool sound effects. Thinking of the concept was the easy part. Learning how to make one proved to be hard. Good thing I found JenLinthwaite’s tutorial. After finding it and building the basics, I spent most of the time tinkering it to fit what was in my imagination. At last! I finished it! Take a look:
If you’re interested to play this game, click here! 😊
A few hours after finishing the project, I immediately jumped to Week 1. This is where the struggle began.
So, back to week 1, everything was new again due to the C Language being first introduced.
This is the part where you learn the basic of basics in regard to the C Language. As with other languages, the following topics were introduced: Loops, Variables, Conditions and Arrays. Some topics were also discussed like Floating-Point Imprecision, Bugs, Memory etc. If you are interested with these, you can see their course here. (Don’t worry, it’s free!)
Week 1 Problem Set
Let’s go now to their problem set. The set gives you an assignment of 4 projects: Hello, Water, Mario and Greedy or Credit. You can make 6 projects if you want since there are two variations of the last 2 projects, but only 4 are required.
1. The first of the problem set was really easy. In fact, with a few minutes on the lecture, you can already solve it. You just have to implement a program that would print out a simple “Hello, world!” to the user.
2. The second problem directs you to implement a program that would give the user’s water usage by converting the minutes spent in the shower to bottles of drinking water. It might sound a little complicated to others, but it’s just pretty simple. You just have to convert whatever number the user has inputted by a conversion factor.
3. The third problem gave me a bit of a headache. Out of all the problems, it was the most difficult for me. It asks you to implement a program that would print out a half-pyramid using hashes and spaces of a specified height from the user.
Before I even proceeded with the formula for the pyramid thing, I had trouble figuring out the do-while loop. I thought I didn’t get the syntax of the do-while at first. It really troubled me since it looked simple. I kept on thinking about it until I observed that all along, I had been using && (and) instead of || (or) in the while part which makes the program go crazy. By the way, the problem specifies that if the user would input a height that is < 0 or > 23, it would loop again and again asking for height.
On my OneNote, I made a replica of how the pyramid would look like and indicated the number of hashes and spaces and which line it belonged to.
I then came up that I had to understand the relationship of the height and hash of the base of the pyramid in order to have a hang of the pattern of it. (I know right, even if it was so obvious graphically.) I then took note that 0 is the total space in the baseline of the inputted height and would get an increment of 1 every time there is a -1 in the height.
Now pause! During this time, I thought I was in the right track, until I remembered that the program would start printing the pyramid from the top to bottom and not the other way around (so dumb, right?). It was also then that I realized that I needed to have a line control in order to know which line the program was printing what. I just continued what I was doing until I successfully solved it!
4. For the fourth problem, I would have to implement a program that calculates the minimum number of coins required to give the user his change.
Whenever the user inputs a number, which is represented as a dollar, you will then have to device a way to convert it to cents with the least amount of coins. The available coins, as we all know are 25, 10, 5 and 1.
After the money (dollar) is received, or inputted, it would then be converted to an integer (cents) by multiplying it by 100. It would then enter a process to check if the quotient of the cents divided by the available coin is more than 1. Of course, the coin 25 would be screened first.
A few hours passed by, I was able to come up with equations and codes. The rest then would be pretty easy.
This experience has really been beneficial and helpful to me. Some of you who are reading this now might have some experience with this (and you’re always welcome to respond with your own experience).
The awesome feeling of achievement and joy after solving a problem is irreplaceable. Do try it if you want to. 😊