Instead
I’m smoking behind my parents house and doing pounds of geology homework

seen from Malaysia
seen from Sweden
seen from Japan

seen from Brazil
seen from Poland

seen from United States

seen from Australia
seen from Japan

seen from Estonia

seen from United Kingdom
seen from United States

seen from United States
seen from United States
seen from United States

seen from United Kingdom

seen from United Kingdom
seen from United Kingdom
seen from United States
seen from United States
seen from United States
Instead
I’m smoking behind my parents house and doing pounds of geology homework
NOOOO!!!! #stupidrocks #gggrrrrr #pleasedontspread
Adventures in Programming -- Week 3
This week we were tasked with a seemingly impossible assignment. Even after slaving over the lectures and optional labs to better understand the material, my brain refused to comprehend how to solve the problem presented to us, the students. Here’s the assignment, in its entirety (meaning we didn’t get any help or assistance beyond the following words):
Your program must do the following:
Start with a rock, centered in the window, with a random sprite and a random diagonal velocity. The rock should immediately start moving
Every second, if there are fewer than 3 rocks in the window, spawn a new rock, centered in the window, with a random sprite and a random diagonal velocity. The rock should immediately start moving
Every update, for each rock that's outside the window, spawn a new rock, centered in the window, with a random sprite and a random diagonal velocity. The rock should immediately start moving
We were provided .png sprite files to use, and a “Rock” class that the professor wrote and included, which did provide some necessary methods. He even includes documentation for us to practice reading and interpreting the kind of documentation that’s found out in the real world. I perused through the class forums, and due to the large volume of students enrolled (over 40,000), there were lots of complaints, problems, and questions available for me to browse through.
After giving up and putting this aside for a day, I came back to it with a plan: read through the forums and take whatever complete and correct fragments of code I can find there until my program runs. Well I lucked out within ten minutes; someone had posted their entire program and a corresponding video to demonstrate the correct behavior. So I, of course, took this code and put into my IDE. After double checking that it worked, I began going through it to understand what was happening under the hood. After an evening of this, I began writing my own code to solve the problem with my new knowledge in hand.
This video is my first attempt at solving the problem:
The first rock spawns and performs great, but the difficulty comes from the second and third rocks. They spawn late, and then don’t immediately move (or move at all). My solution was to comment out and rewrite every single if statement that I’d wrote, and to start over from scratch.
Here’s the correct behavior that’s required (hopefully):
This was accomplished by using a mishmash of code that I had previously eliminated, and fusing it with new code that I rewrote. I’m still not 100% sure which parts went wrong initially, but I think the rocks weren’t updating and drawing properly, or even not accurately deciding if they were within the window, which would then require another update and draw. Moral of the story: don’t delete code, just comment it out in case you need it later.
So that was a crazy experience. Learning curves, am I right? The prof claims we’ll be slowing down a bit after this week, and we’ll begin work on our class project, creating our video game! I guess I can hang around for a little while longer.
I wanna cry.