Tuesday 3 December 2013

Week 11

This post is relative to week 11 of CSC148 (Nov 18-22).
This week's lab was a bunch of fun. A link to the paper can be found here. I looked up some sources to confirm my results and found this site. 
Apart from that not very much new information was given, there was a cool example of the zip(),property() functions of python in the lecture notes...
>>>zip(['2','4','f'],['a','b','%'])
>>>['2a','4b','f%']    
Somehow I've never seen encountered zip().
property() simply protects a target variable..
(example given):
def get_children(self: 'RegexTreeNode') -> list:
"""get private children""" return self._children
children = property(get_children, None, None, None)
In this event, attempting to modify self.children will have no effect:
#c is in instance containing the above function c.children = someobject
Calling c.children after the above code was executed will not return someobject, but rather whatever c._children is.

Monday 2 December 2013

Week 8/9 - Sorting Algorithms

Bubbles Sorting of a List
This post is relative to the period Oct 28 - Nov 8.

The course material finally wandered into sorting territory. I've nearly no past experience with sorting algorithms, except for a specific instance when I had to implement a bubbles sorting algorithm.

I finally took the initiative to learn big Oh notation; I'm still not confident in identifying factorial and logarithmically complex functions. There were some great resources I found here.

On a side-note I just found out Valve released an API for their game Dota2, which can be used to obtain game related statistics. I'm planning on releasing a phone application or a website which can lookup some of these stats. It would be a fun, useful software to write.

Week 7: Linking Lists Together

This post is relative to Week 7 of the course (Oct 21-26)
Not very much new material was introduced this week; rather old material was expanded upon.
The weekly exercises were based around linked lists, which are very similar to binary trees. The work wasn't very difficult.
I started the cheese assignment. Part 1 was nice and simple. Filling in the code worked itself out well and I feel like somehow, indirectly, my understanding of object oriented programming improved by following through the different files.
Last week's test went by well, my marks haven't been given back yet. I made a mistake in the recursion problem. Hopefully it was the only one.

Week 5: More Recursion

This post is relative to week 5 of CSC148 (Oct 7 - 11):
The lectures in week 5 discussed recursive structures. Assignment 1 was given out as well. From past experience, I'm a little worried by the GUI portion of the assignment. The only time I've had fun writing programs with a GUI was when working on random android projects. The one which  generated the most traffic on Google play was a Diablo 3 application which helps maximize a character's dps.
Some screenshots of the program:
The software generated a whopping $15 of profit, but it was a fun time. The coding took very little work, but coming up with accurate numbers was rather difficult. The app is still on the market:
https://play.google.com/store/apps/developer?id=friends%204%20gaming%20%5Bf4g%5D&hl=en

Other than the GUI the assignment shouldn't be too difficult.

Week 4: I love Python

This post is relevant to Week 4 of the course (Sept 30-Oct 5).
RECURSION!
For some reason, I've always avoided recursion. Whenever I was in a situation where I had to use it I could get away with copy pasting code. After one lecture, it seems silly I've never put in 20 mins to learn and understand the powerful and amazing tool that recursion is. This week's tutorial was the first time that I felt I was carrying my partner. The short simple recursive problems were very fun. 
Currently I'm in a mathematics program. I applied to mathematics because I feel that math is beautiful. I can appreciate an elegant proof in a unique way. Never have I felt about another subject the same way until now. Recursion is amazing.

Here is a beautiful tribute to the Fibonacci Sequence (a recursive sequence!):

Week 3: Inheritance, Exceptions, and Good Times

This post is relative to week 3 of classes (Sept 23-27):
Many happy memories were brought back by this class. In grade 12 computer science the teacher gave us the opportunity to use whichever editor we wanted. I really liked the style of Sublime Text Editor, and used it as my primary coding platform. Since Sublime couldn't actually run the code from inside the editor, I was forced to run it in as a python module. This means that simple programs like:
print ("Hello World")
Would run for only a second, and close, regardless of any errors.
Choosing to use sublime meant I had to wrap my code if I wanted to be be able to problem solve.  add this under any block of code I thought might cause problems:
while 1:
pass 
Except Exception as e:
print (e)
Aside from the nostalgia of Sublime, that was my favourite class that year. The teacher would let me and my friends play Counter Strike on the school computers if we finished all the weekly work; we would play counterstrike monday-friday and do all the work at home.

Back to the present; the class material in CSC148 is still mostly review of past projects. I'm having thoughts of switching my major to CompSci but that is probably a mistake at this point. I'm taking most of the courses required for the program, so I can always make my decision after year 1.

Week 2: Introduction to ADT

This post is relative to the Week 2 of the course (Sept 16-20)
One of the cooler things in python is the ease with which lists can be manipulated with. Coming from a java-background, editing lists was always a tedious experience.
I'd like to think that I was a fairly well seasoned coder coming into CSC148, but never really used a stack to store data. In a stack, only the last element added can be returned or removed. New elements could be added to the top of the stack, and the size of the stack can be determined.
In Python, lists can be used like stacks...
a = [3,4,5,7,8]
a.pop()
>>>8
a
>>>[3,4,5,7]
The first set of problems was due the end of the week. The course content is still very straightforward. I'm enjoying going to class and taking it easy as things ramp up.