Python! I started this class back in September and I can already go back and look at extreme differences in how I would approach coding algorithms or draw through the pretty nifty turtle feature. In fact, I liked the turtle options so much I think I may have invested just as much time into it as learning the standard syntax. The following is the first thing our teacher had us copy down from the projector, the code that outputs the image up above is below.
Suffice it to say I had no idea the basics even before starting, but I found this first code an excellent introduction to where we were headed for the class. A turtle was a shelled creature before the first day as far as I knew. The book we were using:
The text is straightforward, and I’ve definitely got a good foundation of where to go from here after this first foray into the language. Besides, I found some severe astronomy tools that can be implemented in this style. I’m sure there are better things for studying stars or planetary sciences, but this scratching the surface has been exciting. Speaking of, here’s an Orion.
And this is the code from the book that I copied verbatim, but could be manipulated or added to something much more significant.
It was informative to go through the program step by step when I was rewriting it and see just what was going on. This was before I even knew what CONSTANTS were or how the turtle also performed. To see how self-explanatory the code was going through it line by line lifted a bit of worry off the shoulders because you just never know how easy concepts are going to be to grasp sometimes, at least I think so.
Below are two images from the first journal entry I did for the class. I was inspired by the turtle design and wanted to explore it further. The goal was to edit a stripped down version of a Hit the Target Game. The initial game was just to input a trajectory and a force value to hit a set box on the screen with a plain white background and a black line to an empty box.
What I did was add stars, the background, planets, the Death Star, “That’s no moon!” And a helpless victim to be shot upon. The force and trajectory are still decided by the user, which I turned into a laser from the Death Star.
My main takeaways from this exercise were with only a basic knowledge of three chapters there was still a multitude I could accomplish by editing preexisting starter code and adding in a bunch of my own code, as well. My final code I finished is below, and you’ll see this was definitely before functions and I was just starting my if, elif, else, turtle, and constants knowledge.
The following I was pretty proud of because merely two chapters later I took what I learned from all my other turtle knowledge and implemented them into a drawing that I wrote myself. This time we were getting around to talking about functions, so I was able to play with those, which are just invaluable let me tell you.
The program asked to make a cityscape skyline, which I did, but my son loves Star Wars, Batman, and the like. I made Star Wars on the last one, so this one I went ahead and incorporated the Batlight to make it seem like Gotham City.
The following is the code for the above. It starts off with drawing a random assortment of stars in the turtle setup grid and then depicts the skyline and buildings, then finally drawing out the Batlight.
The following turtle we did as a class, it is a function based checkerboard drawing that uses for loops if-else statements, ranges, constants, most of what has been practiced the last few chapters.
The code below was done as a team to learn the behavior of coloring in patterns a certain way, very cool.