Sunday, 29 March 2015

The End?


Could it really be the end already?
Just a few short months ago the course was beginning and I was setting up this blog. I'll very likely post some other things here for personal enjoyment but definitely not at the rate a course schedule encourages me to. For now, I'll just review the hurdles:

Recursion. It wasn't the easiest conception to envision once the problems became more comlicated, but I think my last assignment really will prove how far I've come.
Linked Lists. I'll level with you all: I messed up Linked Lists last test. I'm going to get my act together for the exam, and could use all the good luck I can get. (And hard work too I guess)

But here we are looking at measuring program times for our 2nd last week. A concept explained in our class accomplished more than the last two weeks of the other course I'm taking that explains "big-O" notation and so on.

Here's to an excellent year and hopefully and excellent exam mark to show for it!
Cheers
ES


Sunday, 22 March 2015

Back in Time


Hello again! This week, despite the low amount of posts, I'm looking back at the past in regards to this blog. Post #1 Specifically.



Ahh. Post #1. Simpler Times.
Ridding my eyes of the rose-tinted nostalgia glasses, It's clear that I was speaking outside of direct experience. As an observer I seemed to have plenty to say about communication in computer science, and can't really say I disagree with myself here or on such an observation. 

"if you can't communicate your ideas or code to the other people on your team you're actually a liability, even if you produce amazing code"

Woof. Strong words. I can't deny I still agree with them though. A great way to get nowhere fast in the world (I imagine) is be a poor communicator. Ask me who I'd rather work with, an average-skill person with above average communication skills or an above average skill person with average communication, an I'll always pick the good communicator. We'd just get more done.

"That's why "geeks" should write, especially logs like this one will hopefully become. If you log a problem the solution may come to you more easily."
 
The words of a hypocrite! Who is this guy?

I won't give myself too hard a time but clearly my notebooks get more attention than this blog. I'm searching the margins of my pages when I could just be archiving and accessing my problems right here. That way I'd be working on my communication at the same time, and it's never too late to change! All in all though, it's been a good term. Here's hoping the exam goes well for everyone!

Cheers,
ES

Sunday, 15 March 2015

Last Week

Yet another week has come to pass, and with out most recent test out of the way I'd say it's time to reflect.

Altogether it could have gone better, and mismanaged time is a key concern of mine during tests. This one was no different, but it still seemed I'd fallen short of where I wanted to be once time ran out. The final question was in regards to linked lists, and ultimately navigating them is still an issue for me. For example, determining where a value is in a linked list and placing a new value in it's place is not as simple as it sounds. One drawback when it comes to thinking with linked lists is a lack of spatial numbering (like that of a normal list). There's no LL[10] to get the tenth value in a linked list, instead only a reference to the front is available.

I ran aground during the test when I had to modify a linked list and couldn't accurately tell if I correctly altered the list without ruining whatever came before it. It was frustrating to say the least. I haven't found the time to hammer out the correct solution on my own just yet, but I'm not giving up while there's such an obvious hole in my learning. You win some you lose some!


Cheers and see you next week,
ES

Sunday, 8 March 2015

Linked Lists: Lists with Links

This week the main topic of focus has been linked lists, a chain of information in which a single list contains two values, one object and a link to another list of the same, or else None.

My most common hiccup when thinking about this concept is the difference between  linked list and nested list. It helped to punch one out and compare it to what a linked list has been described to me as.

Nested List -> [1, [2,[3, None]]]


While a nested list's lists literally contain a list as their second (or third, or fourth... etc) value, the difference between such a list and a linked list is that the simplicity of a linked list is in it's two-value length: a data value, and then a reference to another list of the same type (or None if at the end of the list).

Nested Lists are Russian Dolls, Linked Lists are Conga Lines:



In all honesty, Conga lines really are a lot more fun.

Cheers!
ES

Sunday, 1 March 2015

Object-Oriented Programming: One of the rare instances where objectification isn't cruel

Hello! Once more I'd like to divulge some thoughts on a specific part of computer science I find particularily of help to my learning and programming competence: Object-Oriented Programming.

After graduating from the limited sensorimotor stage of one's infancy, the human brain is capable of understanding that there exist instances of things in our life, such as people places and things which are unique and not nessecarily limited to the ones we can currently see, feel or hear. Object-Oriented Programming is, in my understanding, object permanence (knowing something can exist with or without it being currently in play) for the coding process. Consider an example challenge:

We'd like a write a program about pens. Perhaps for organizing types of pens. We know that not all pens are the same. How will we be able to work with pens, telling them apart from each other, easily representing what they are? OOP helps.

We know pens have different colours, and we can organize characteristics like this one in an Object. This makes sense of course. Pens are, in fact, objects. But just like in real-life: it's quite handy to have a basic idea of what a pen is in order to avoid confusion.

Are quills pens? Depending on the design of your program, quite possibly. Confused?

So! We've decided pens are something important enough that our program will deal with them as instances of a Pen object. Listing off colour as a characteristic of interest, we write code that allows us to create pen objects with strings representing names and colours. Our lives just got a whole lot easier. Why?

Because we can now more easily manipulate the idea of pens in our code, write code that allows us to compare them, which then allows us to more easily organize them. Wait, wasn't that what we were trying to do at the start?

"We'd like a write a program about pens. Perhaps for organizing types of pens." -Adventures in SLOGing 2015


Well, there we go. Just by doing a few simple steps we've created a sensical basis for our program, and that's good in more ways than one.

Because we've written up Pens as an object and attentively commented our code (obviously) it's far easier for an outside party to view and understand what we've written, as well as modify individual parts of the code without as great a risk of messing things up. Presto: versatile, understandable, and effective code.

Thanks to Object Oriented Programming, Dennis successfully launched his Pen company start-up and became a billionaire. Here he's pointing to this blog, citing this post as the sole reason for his success.

I struggle to come up with a complex problem that wouldn't benefit from code written in an Object Oriented design, but realize I am only starting out on the learning process.

Until next week, cheers!
- ES

Sunday, 8 February 2015

SLOG #3: Thoughts about Random

Hey all, back for round three. Nothing especially groudbreaking this week, and a course test that took place a few days ago went along without a hitch for most everyone I've heard.

I have been thinking back to assignment 1 lately, but more specifically the generating random numbers element of the code. For example lets look at this:

>>> game_range = 10
>>> x = int(random.uniform(1, game_range + 1))
>>> x
9

Generating random numbers is an essential computer task, especially for cRPG's and other chance based games, but how does it work in regards to computers? From my basic knowledge of how computer's work deep deep deep down, how does one generate a completely random number?

Apparently they didn't use to. In my curiousity about the history of video games I've learned a tiny bit (no pun intended) about the way older computers worked. The interest in "random"-ness began by watching the video form of a thesis written by a certain Dr. Tom Murphy. He'd written a program, a very simple one, that played Nintendo Entertainment System games. No specific parameters for each game either. It was universal and, in this day and age, not too taxing of a program to run, all based around the potential increase in numbers always going on inside the NES.

Video version of Dr. Murphy's explaination available here: https://www.youtube.com/watch?v=xOCurBYI_gY
The actual paper: http://www.cs.cmu.edu/~tom7/mario/mario.pdf


In one of the uploaded videos of the program in action, it remarkably manipulated games with "random" power-up drops via button presses to make sure the power-up that gave the program the most points was always dropped by certain enemies. Always! The program was able to do this because one of its functions was simulating the future effect of a potential button presses or movements for each and every frame of the game. This doesn't explain how it managed to get the exact power up it wanted every time from a supposedly "random" drop though!

Turns out, to simulate "randomness" the NES actually takes things like player input and button presses into the equation. The users, playing away on the NES controllers, were providing some of the "randomness" for many of these games! To makes sure 1 of 6 power-ups dropped each time though, you'd have to be a computer program like Dr. Murphy's. I found this mind blowing.

I guess I just wanted to share how cool I found that video and computing idea. Still working out how exactly we accomplish "random" in computer and games nowadays though, but cheers and hope I find out in the future!
ES


Sunday, 1 February 2015

SLOG #2: Classes and classes

Hello again!

This still isn't too technical of a post (I'll likely get more technical very soon) but I'd just like to cement what the difference in learning from CSC108 and CSC148 has been like for me so far. As far as Object Oriented Programming goes, the class and subclass expectations are much more in keeping with the world of actual programs and so on. For the most part it's a fairly simple concept making a lot more sense than beginner programming, which involved uber-specific programming implementation.

Assignment 1 is a good example of this change.

Wheras essentially just the final assignment of CSC108 was about multiple class/file design, 148's first assignment has involved ADT (Abstract Data Types) from the get-go and offered vast leniency on how precisely the job was to be completed. This makes the project harder and easier to complete at the same time, because now as a coder there is room for your own personal discretion but also a lack of hand-holding that the simplicity and specificity previous code projects had to make themselves less challenging. Both of these changes are good. It makes the work more satisfying.
Here's an example of what I mean:

Let's say you have a scrambled Rubik's cube, and a guide for unscrambling Rubik's cubes.

Scenario 1: The guide has the exact movements for each possible scrambling (it's a stupidly big book) and following the steps for the scrambled cube results in your Rubik's cube being solved.
Scenario 2: The guide explains the methods by which a Rubik's cube is solved, by offering information that applies to all possible or most common issues in solving the cube.

Which scenario is more satisfying? Definitely scenario 2.

Following instructions can be fun, e. g. a Lego instruction booklet, but when faced with a challenge it is more enjoyable to see yourself understanding and actually learning how to approach different parts of the problem to solve it based on knowledge, experience and savvy. e.g. being able to solve a Rubik's cube and so on. I guess what I really wanted to do here is share why I'm enjoying and pursuing Computer Science. Once you learn something in this subject it is execptionally enjoyable to implement and usilise it on other problems, precisely for the reasons I've stated above.

Cheers,
ES