Tuesday, May 11, 2010

Why this?

Why everyone has to lie and be afraid of the truth? Why we have to learn the truth from others and not from the ones we were together? The answers sure differ and I believe that telling the truth is much harder than simply thinking about it. However, I can’t live with lies… It’s in my nature to trust people but some can’t understand this…

Why are some people so narrow minded? They simply can’t hear other voices except theirs. For example why believing that gaming is only for the ten-year-old?

EddsWorld - MovieMakers

An amazing animation!

Friday, May 7, 2010

Python – Classes Again

Here is the program with better output

Code:

class Market:
    '''Manages a list of items I need to buy'''

    items = 0
    basket = []

    def __init__(self, item):
        '''Writes down the item'''

        self.item = item

    def Item(self):
        '''I decide I want to buy the item'''
        print('I have to buy {0}!'.format(self.item))
        Market.items += 1

    def ItemBought(self):
        '''I bought the item'''

        print('I have bought', self.item)

        Market.items += -1
        Market.basket.append(self.item)

        print('Items left to buy :', Market.items)
        if len(Market.basket) >= 2:
            print('The basket now contains', end=' ')
            for i in Market.basket[0:-1]:
                print(i, end=" ")
                print('and', Market.basket[-1])
        else:
            print('The basket now contains', end=' ')
            print(Market.basket[0])

    def Check():
        '''Checks if I have bought everything so I can go home'''

        if Market.items == 0:
            print('I have everything. Time to go home!')
        else:
            print('I have more shopping to do!')

    Check = staticmethod(Check)

item_a = Market('bananas')
item_a.Item()
item_b = Market('apples')
item_b.Item()
item_b.ItemBought()
Market.Check()
item_a.ItemBought()
Market.Check()

Output:

I have to buy bananas!
I have to buy apples!
I have bought apples
Items left to buy : 1
The basket now contains apples
I have more shopping to do!
I have bought bananas
Items left to buy : 0
The basket now contains apples and bananas
I have everything. Time to go home!

Thursday, May 6, 2010

Trading Yesterday - For you Only

Loving the slow pace and the lyrics…

Python – Learning Classes

A simple program I made while learning about classes

Code:

class Market:
    '''Manages a list of items I need to buy'''

    items = 0
    basket = []

    def __init__(self, item):
        '''Writes down the item'''

        self.item = item

    def Item(self):
        '''I decide I want to buy the item'''
        print('I have to buy', self.item)
        Market.items += 1

    def ItemBought(self):
        '''I bought the item'''

        print('I have bought', self.item)

        Market.items += -1
        Market.basket.append(self.item)

        print('Items left to buy :', Market.items)
        print('The basket contains', Market.basket[:])

    def Check():
        '''Checks if I have bought everything so I can go home'''

        if Market.items == 0:
            print('I have everything. Time to go home!')
        else:
            print('I have more shopping to do!')

    Check = staticmethod(Check)

item_a = Market('bananas')
item_a.Item()
item_b = Market('apples')
item_b.Item()
item_b.ItemBought()
Market.Check()
item_a.ItemBought()
Market.Check()


Output:

I have to buy bananas
I have to buy apples
I have bought apples
Items left to buy : 1
The basket contains ['apples']
I have more shopping to do!
I have bought bananas
Items left to buy : 0
The basket contains ['apples', 'bananas']
I have everything. Time to go home!

I made a version with better output before but I am too lazy to upload it now. I will do it tomorrow :-)

Wednesday, May 5, 2010

Tuesday, May 4, 2010

Sunday, May 2, 2010

Iron Man 2

poster_ironman-2 I watched Iron Man 2 yesterday and I have to say that it was better than I expected. It featured a lot of action and special effects. However, I think that some things in the movie are far away from reality. But in the end it’s a Sci-Fi movie :-)

Saturday, May 1, 2010

Infamous - PS3

Playing Infamous on PS3 and I have to say that it is a little difficult for me to platinum this game but I will try my best because it is an awesome game. Playing on hard right now. I also have to make 6 more stunts with all of them being either difficulty or tricky…

I also heard that rumors about a sequel of Infamous (Infamous 2) are getting stronger. It would be good if we could play it soon!

If Today Was Your Last Day

Amazing song if you ask me :-)