Friday, January 5, 2018

Retro gaming

Time flies so fast... Before Christmas, I was lucky enough to find out, during a loose conversation with a new colleague, that he is an old-hand when it comes to classic RPGs. We talked a little bit and we recalled the good ol' times of Baldurs Gate. That made me look around the house for the boxes, that as a child, I was able to rescue from my parents ("this is just a box, you do not need it, it is taking space" and this kind of things).

Recalling the past

I still remember reading the review of Baldurs Gate in local (Polish) newspaper called CD-Action. It got 9 out of 10 and if I remember correctly, the short-sighted reviewer argued, that the latest Final Fantasy is better. Quick investigation reveals his name was Allor and it seems he is still working for CD-Action, despite obvious mistake of not giving BG 10/10 ;)

I also remember when I got the game. It was a present for Christmas of the year 1999. I did not expect that at all, I did not ask for it (silly me), but I liked fantasy a lot (I have read LotR and enjoyed it) and liked computer games. My father liked same things and that way I (we) got a wonderful present. At that times there was no option to test games right away, all of this had to wait for next day, but there was something else, that I miss dearly nowadays. Look at the picture below:


Yes, that is right, this is how games were sold then. It is not some kind of special collector edition, no this is just a regular game. Games were much more expensive relative to earnings compared to now. They were sold in large boxes (275 x 220 x 55 mm) with gorgeous graphics and a lot of goodies in there. For example, the original Baldurs Gate was released on 5 CDs (yes, CDs) and was bundled with a thick book, that was instruction, another book (an even thicker book, that was a regular Forgotten Realms book) and a map. Even though I was not able to play, I could read the instruction and I did. I still remember that I read it from start to the end, checking those Thac0 tables, spells and others. It probably sounds funny now, but back then it was something, at least for me.

Next day me and my younger brother installed the game. As I had to leave for something with my dad, my brother was left and was the first to play. I am not sure if he was able to properly understand what this game is about, as when we came back he told us, that he finished the first level. By that, he meant he was able to pass it, like in a Mario-type game. Discovering things for the first time is really charming when you do it, but when you look back at it, it seems funny and strange.

This is enough for the first time, I have to write short and to the point, as otherwise it is taking me too much time and it feels like work, not like a pleasure :) I will try to find other boxes and share some of my treasures with the world!


TL; DR

Baldurs Gate rocks, I was naive when I was young, in the past games had shiny boxes and additional goodies. Check later for more pictures of old boxes.

Friday, May 5, 2017

LEGO Islanders sets review

The time has come - some sets have to be packed and it is an opportunity to take a closer look at them and write short review. Here we go with one of the Pirates subtheme - the Islanders.

6236: King Kahuka

Even though it is the impulse set of the theme, it offers large amount of bricks (41). It is quite a lot more than impulse sets usually have and in addition to this it is placed on a large green plate (6x8)! The set consists of a throne with some decorations (2x shields and 2x spears, a lot of weaponry!) and a treasure hidden under the seat. A hinge is used to allow placing and removal of the treasure. There is just one minifigure and it is the king Kahuka himself. All in all this is a great set, probably one of the best in impulse category in Pirates theme, especially when the value for money is considered (it cost 4,00$).


6246: Crocodile Cage

The first small set have only 49 pieces - a few more than the impulse one, but offers two minifigures - a pirate with wooden leg and unusual hat and an islander. There is also a crocodile, a parrot and a full range of accessories (shield, 5 spears, musket, saber, quiver and bow). All of this is placed on a 6x12 green plate. Apart from a small prison with a hinge there is a green bush on the stone, a campfire and a tribal emblem. Overall this is my favorite set of Islanders. The vast amount of things you get here is worth appreciating, but i have to admit, that this is a set I (or my brother) owned as a child, which probably influenced me a little :)


Bad croc attack! Luckily the replaceable leg was bitten :)


The dance around the fire


Think you are safe up there?


Croc rides are coming for ya!

6256: Islander Catamaran

Another small set, but looks larger than it really is (just 53 pieces) because of the two big canoes. This set was also quite pricey - 12,00$, while previous one was 7,50$. There are two minifigs here - a king and his wife / daughter (?) or just a female islander, which is awesome - more variety in the tribe. There is also an obligatory crocodile (are those tamed crocodiles or a wild and dangerous ones?). The rest is unfortunately disappointing. The whole catamaran is a few pieces that connects both canoes with some decorations on front and back. The nice thing is the drum included, but on the other hand, the ornaments on the canoes are not printed, these are stickers :( All in all this set have some ups and downs, but is necessary for anybody interest in Islanders - this is their only ship!


New lands, we are coming!

6262: King Kahuka's Throne

The first thing that strikes the most when looking at this set is - oh... boy five (5!) minifigures. A tribe king, two warriors and two pirates. This medium set has 124 pieces and consist of two parts - a green baseplate of size 16x16 that is the Islanders territory and a red boat for pirates. Also an obligatory crocodile is somewhere in the middle of the pack. The good things - pirate boat has rotating sail and nice mixture of weaponry (two rows, two pistols, a saber and a map). The Islanders part has some smaller elements like a litter and a stand for it, a camp-fire, a drum and one bigger building / cave. This building is the not so-so part of the set as it is mostly made of of BURP (Big Ugly Rock Piece) and holds a treasure chest. The stone face on the top of the cave is the bright spot of the set on the other hand. It looks great and the build process is enjoyable and interesting. All in all this set offers many minifigs, some interesting parts and ideas. Also it had nice value for money (21,00$).




6264: Forbidden Cove

Another medium set. This time we get more pieces (196), but one less minifigure (4). Unfortunately the split is 50/50 - two pirates and two islanders. One of them looks like a unique, but in fact has a torso and head of a king, but without a red mask. I heard rumors stating this is king Kahuka's son :) The set is based on a large blue baseplate (32x16), has both a canoe and a boat, but each is in the most simple form (no sails, etc.). The building have two levels - a cave on the bottom and a level above it with a roof. As usual BURP are used, but there are some nice elements like a new stone face on the front of the cave. This also serves as a hidden entrance to the inside and is movable (see pictures). Ohhh... I almost forgot - a croc... (no! this time it is an alligator!) and a parrot are included. Overall interesting set, but in my opinion more Islanders instead of pirates and something in place of croc... alligator could be used. Also the price increase (29,75$) in not justified compared to the previous set.


Pirates think they got the treasure but disturbing sound of drums can be heard!


The pursuit unit has arrived. Surprise!

6278: Enchanted Island

The large set of the theme, the flagship one, the one, that was re-released - Enchanted Island! It is really big as it is based on two (!) 32x32 baseplates, one with some high ground. It should be noted that one of them is unique to this set, while the other one is available in just one more set. The set includes 7 minifigures, that are split in the right way - 2 pirates, a king, female islander and three warriors. Finally a tribe that is structured properly - 4 people per one manager, no unhealthy 1-1 ratio  known from previous sets :) The pirates are rolling in a boat with two sails, while Islanders have a canoe with a sail. There are a few buildings there and a hidden treasure. The buildings are connected with a hanging bridge that offers some "playabilty" - can be rotated when enemies are there - it's a trap! While the building looks nice from the front they are seriously lacking from the back - the whole thing looks empty and lacking details, the lone fire, drum and a bench is not enough. The bright spot is the stone prison with a stone face on top of it, although the same was previously seen in King Kahuka's Throne. Overall I would call the set a little bit of a disappointment. In my opinion it is much worse than a standard flagship sets - boats and even compared to other bases like Eldorado Fortress (built on top of one baseplate) or Imperial Trading Point. The first one has much more details, while the latter offers a small ship in there! I would say, that Enchanted Island is on similar level as Rock Island Refugee (not a fan of it).





Are we stuck here?

Some additional photos of all Islanders sets:


Islanders fleet


The cavalry is coming





Summary

The Islanders are definitely a nice addition to whole Pirates theme and I really appreciate it as a new faction. It is a pity, that they were offered only for a year (1994). They seemed a little bit outgunned (literally) by other factions cause I do not give them much chances with spears, bows and especially low numbers :) While we are at numbers - this is the thing that bothers me the most with Islanders - why they have almost more kings than normal warriors? Something went wrong and they trained too many managers I guess. The other thing is crocodiles - are they really needed in every set?


Last, but not least, my personal rating list:
1 place:
6246: Crocodile Cage - many weapons, two minifigs, a lot of details

2 place:
6236: King Kahuka - awesome impulse set - a lot of pieces for this size

rest:
6262: King Kahuka's Throne - five minifigs, but the building is severly lacking
6278: Enchanted Island - a little bit of a disapointment for a flagship set
6256: Islander Catamaran - seems empty
6264: Forbidden Cove - interesting building but really pricy for what it offers

Bonus

This is not an Islander set, but the only additional one that includes tribe people.


Can you guess its name and number?

Fun fact - this set was limited to US and is quite difficult to get. I have it with the "safe" non shooting canon :)

Friday, April 21, 2017

The LEGO problem

Last time I told you about my new hobby - LEGO. What can surprise you is that I am still collecting sets and I did not jump to something else, like with other hobbies, that sparked my interest for a brief moment. There is only one problem and it is of utmost importance that I will tell you about it, so you are fully aware of what to expect when starting your own LEGO journey.

1) there are over 13 000 LEGO sets created! You can admire a few randomly chosen sets here:
http://brickset.com/sets/random

2) you will find a lot of sets that appeal to you. For me, due to sentiment, the pirates were the one that I wanted the most.

3) you will start collecting chosen theme. More and more sets will come and you will enjoy every second spent on building them.

4) to justify spending so much money on old, plastic toys you will persuaded yourself that this is some kind of an investment. That you will earn in the long run as price of LEGO is climbing all the time. The truth is... it will not happen, you have alread felt in love with those sets and one does not sell beloved ones!

5) grown men and women that plays or collects LEGO bricks are called AFOLs (adult fan of LEGO).

6) you will find out that not only Pirates theme is awesome. Look at Castle, Space, City, Technic... so many to collect! Wach out for LEGO Movie, as it makes you want more sets.

7) bidding and buying LEGO bricks mixes by kilograms is a refreshing experience. Sets you did not know that exists, sorting vast amounts of bricks, finding out that you have 5 kg of LEGO bricks from sixties (1960s)...

After all of this you will discover that LEGO bricks and sets are all over you house. On your desk there are sets waiting to be unpacked and build. Loose parts are on your left and right, you were missing those in a set you built last month and now you have to insert them it in the right place. Every table and wardrobe will be possessed by minfigures... When you wake up one day with a back pain and found out that some lost LEGO piece caused that you will now... The time has come. You have way too many sets and you have to put some to rest (I mean disassemble and pack them so that less space is required) :)

I am already past that point. I need a lot more space to keep the bricks in check... Prepare for some reviews and photos as I would like to say them goodbye with an honour. Here are a handful of sets awaiting their fate:



TL; DR

This post is about typical first world problems - ohhh.... no... I have too much LEGO sets. My life is ruined ;) Also... LEGO collection is growing every second and needs to be dealt with!

Thursday, July 21, 2016

Being an adult has some advantages (LEGO adventure + first MOCs)

Dear readers,

today I would like to share with you information about how I rediscovered the passion for LEGO pirates bricks and show you some of My Own Creations (MOCs).

Back in the days

When I was a child I got a lot of LEGO sets from my parents (I would like to thank them for that!). Most of them was rather small as salary in Poland was really low at that times. According to this source for an annual(sic!) average salary one was able to buy 108 USD. In other way around for a whole year work you were able to buy 1989 flagship - Black Seas Barracuda. With some LEGO sets the shops were giving the catalogues were I was able to admire the largest and most epic sets. I always glared the most at the pirates themed pages. To this day I remember some of them:



Coming out of dark ages

Few weeks ago while doing some work I was asked to position a marker on my desk so specialized
tracker can detect it and got an advice that LEGO bricks can be useful for that. This started everything. Later that day I pulled out of a closet some bricks that I bought on an auction portal a couple years ago. I don't even remember how much it was - one, two or maybe three kilograms. There were a lot of mixed sets, but few were almost complete. It even had some pirates and islanders! I play with thema little bit and got infected...

The madness starts

As I stated earlier - pirates were my favourite theme and I started looking for them. Now it's like Pokemon go frenzy - Gotta Catch 'Em All! And this is the best part - as an adult you do not have to wait for Christmas!

My own creations (MOCs)

From a couple of minifigures and sets I bought I have prepared some own creations.

The first one is entitled: "The vultures are coming"


The lone pirate has sipped all his beverage and there he doe not see any rescue coming. The see is everywhere around him and there is only on bullet in his gun. The sea vultures are gathering around as they feel the inevitable...

The second one depicts the soldier who has passed out during the interrogation. At the moment he is taken by medical services to be prepared for the second meeting with the interrogator.



The last scene presents two sides before incoming confrontation. How centuries of tradition and honor will fare against intruders that bring the technology and progress? Which one will prevail at the end? Who will rule the land? Do the natives has any chance?




BTW sorry for rather depressing theme for MOCs - some real world troubles made my thoughts grim.

TL; DR

LEGO bricks are awesome! Pirates are even more awesome! Get amused by my own creations!

Tuesday, April 12, 2016

Blog and challanges summary

I started this blog to write about things that interests me. At the beginning it was a little bit about motivation and running [here]. I set some goals for myself to achieve [here] and event create a page that stores all my successes and failures [here].

Today I would like to end this part of my webpage so I will do a quick summary of how I failed hard and succeed in some of the challenges.

Challenges summary - failure part

Lets start with the bad news - in both of the running challenges, namely:

  • run half marathon in 2015
  • run marathon in 2015

I failed. Last time, that I wrote about running [here] I mentioned that I got injured. Unfortunately the recovery period was long (I tried running after 2/3/4/5 weeks and my knee was still hurting). I took some pills but it did not help. I did some exercises instead - ride a bicycle, did over 100 km while cross country skiing. The break from running made it impossible to take part in half marathon in Poznan in April. I started running in April and gradually increased the intensity (I read a book about running during while being injured). Unfortunately in July my knee started hurting again and I had to pause running again. This shattered the dreams of marathon for me.

On the bright side of things - I bought a bike and I enjoyed riding it. I did almost 1500 kms last year, while in previous years I did not ride at all. I was even able to ride over 100 km in one day which I am proud of :) All in all despite not fulfilling my plans I enjoyed the year trying different sports.

Additional note for other people that are starting running or are planning to - do not force yourself to much. I know it is nice to exhaust yourself after a long day in front of the computer but for the sake of your health run slowly. Really. Or read a book or run with somebody at pace that you can talk comfortably.

Challenges summary - I don't know what it is part

I started the blog to express myself to the world. To hone my writing skills. To share my ideas. I challenged myself to keep the blog up with regular updates. It is still alive. Maybe not exactly alive and kicking but also not on the verge of death I guess. What do you think my dear reader? Was this challenge a success or was it a failure?

Challenges summary - I did something right part

At the beginning of the year somebody showed me a program for a mobile phone that allows learning the foreign languages. I am talking about Duolingo. It is really well executed application and what is most important it is free (and can be used on both mobile phone and the PC thanks to being a webpage). I started doing the exercises and today I achieved 100 days streak (which was my goal). That means I did the necessary exercises each and every day starting from 4th of January. I finished all the lessons a while ago and now I only did repetitions and it is less interesting that new lessons.
I would like to encourage everybody to try the Duoliong and the method of learning by small but frequent exercises. On the downside there is only one level of Polish-English course and is rather simple.

TL; DR

When I started this blog I set myself a few goals (challenges). Today I revised how I fare - I described my failures and successes. Now I retire this part of the webpage - no more challenges for me (at least for now). The archived ones can be found here.

Friday, January 15, 2016

Python is Over 9000!

In my last post I asked you, my dear reader, to try and flex your programming muscles solving some tasks in C++ language. Now is the time to compare the solutions of the aforementioned exercises in both Python (written by me, please take a note that I have learnt Python in the last year) and C++ (solutions from my friends who know how to program). Big shoutouts to them, as without their work this post will not be that long. You can check their profiles on github - przemkovv and MichalNowicki).

The code

1) lets assume we have two collections and would like to print values from them in the following format:
value_0_from_first_collection, value_0_from_second_collection
value_1_from_first_collection, value_1_from_second_collection
etc.

So for the warm-up we are doing something rather easy, that in Python looks really straightforward:

for n1, n2 in zip(numbers_1, numbers_2):
    print(n1, n2)

For those not familiar with Python - you can check zip function here. In this case it is returning elements from both collections which are assigned to names n1 and n2.

In C++ it looks a little bit more cumbersome (what are this magical * sign? :P):

for (auto it = kolekcjaA.begin(), it2 = kolekcjaB.begin(); 
     it != kolekcjaA.end() && it2 != kolekcjaB.end(); ++it, ++it2) {
    std::cout << *it << " " << *it2 << std::endl;
}

Or if you use some dark magic you can get something similar to what Python is offering:

vector<tuple<char="", int="">> out_zipped;

transform(vec.begin(), vec.end(), str.begin(), back_inserter(out_zipped), [](auto x, auto y){ return make_tuple(x, y);});

for_each(out_zipped.begin(), out_zipped.end(), [](auto t) {
    cout << get<0>(t) << ", " << get<1>(t) << endl;
});

It gets the job done but I would say that Python solution is much neater.

2) lets assume we have a text and we would like to print it without the first and the last sign. In addition we would like to print the text length.

Python:
print(text[1:-1], ", " + str(len(text)))

C++:
// solution 1
std::cout << text.substr(1, text.size() - 2) << " " << text.length() << std::endl;

// solution 2
string cut_from_both_sides(str.begin() + 1, str.end() - 1);
cout << cut_from_both_sides.length() << " " << cut_from_both_sides << endl;

All of them looks similar, but look at the next task to see the advantage of Python solution!

3) we have a collection of values and we would like to print it without the first and last values. In addition we would like to print the size of the collection.

Python:
print(numbers_1[1:-1], ", " + str(len(numbers_1)))

C++:
// solution 1
for (auto it = kolekcjaA.begin() + 1; it + 1 != kolekcjaA.end(); ++it) {
    std::cout << *it << std::endl;
}

// solution 2
vector<int> vec2(begin(vec) + 1, end(vec) - 1);
cout << vec2 << endl;

As you can see the Python is still using the same way, while C++ solution 1 evolved to using iterators, while the C++ solution 2 is the same but will not work for lists (and other collections that do not offer [] operator)!

4) we have a function that has to return:
a) two values,
b) three values.
How would you implement that?

Python:
def increment_all(a, b, c):
    return a+1, b+1, c+1

x, y, z = increment_all(x, y, z)
print(x, y, z)

C++:
auto triple_return() {
    return make_tuple(5, "good", 3.5);
}

auto gotcha3 = triple_return();
cout << get<0>(gotcha3) << " " << get<1>(gotcha3) << " " << get<2>(gotcha3) << endl;

To save space I left just triple return. At first glance all the solutions look similar, but take a closer look how you print the returned values and you will appreciate Python simplicity. Also it is possible to swap values without additional buffers:

a, b = b, a

5) for collection of your choice do:
a) print all values,

Python:
for v in values:
    print(v)

C++:
for (auto value : vec3) {
    std::cout << value << std::endl;
}

Nothing extraordinary. C++ has similar construction for getting elements from collections.

b) increase each value by 10,

Python:
values = [v+10 for v in values]

C++:
// solution 1
for (auto& x : vec3) {
    x += 10;
}

// solution 2
transform(begin(vec3), end(vec3), begin(vec3), [](auto x) { return x + 10; });

This is where things start to be interesting. In Python you use thing called list comprehension, which is general and elegant way to work on containers. In C++ you can use solution similar to the last one but you have to remember to use another special C++ operator - &. Solution 2 is a way to mimic Python behaviour.

c) remove last element,

Python:
values.pop()

C++:
// solution 1
kolekcjaA.resize(kolekcjaA.size() - 1);

// solution 2
vec3.pop_back();

Nothing special, but C++ guys offered two different solutions :)

d) remove n-th element,

Python:
n = 2
values.pop(n)

C++:
// solution 1
int n = 4;
kolekcjaA.erase(kolekcjaA.begin() + n);
}
// solution 2
const int nth = 10;
vec3.erase(begin(vec3) + nth);

Once again C++ solutions does not work for lists.

e) print value alongside its index,

Python:
for i, v in enumerate(values):
    print(i, v)

C++:
// solution 1
for (int i = 0; i < kolekcjaA.size(); i++) {
     std::cout << "Index = " << i << " " << kolekcjaA[i] << std::endl;
}

// solution 2
int i=0;
for (auto it = begin(vec3); it != end(vec3); ++i, ++it) {
    cout << i << " " << *it << endl;
}
// solution 3
i=0;
for (auto x : vec3){
    cout << i << " " << x << endl;
    ++i;
}
// solution 4
for (auto p = make_pair(0, begin(vec3)) ; p.second != end(vec3); ++p.first, ++p.second) {
    cout << p.first << " " << *(p.second)  << endl;
}

In Python this is straightforward - enumerate and done! C++ offers a lot of solutions, that have some pros and cons. I prefer to have one main solution - it helps when more than one person is working on with the code.

f) check if value x is in collection,

Python:
if 27 in values:
    print("27 is in the collection")

C++:
// solution 1
bool contains_25 = find(begin(vec3), end(vec3), 25) != end(vec3);
cout << contains_25 << endl;
// solution 2
auto contains_x = [](auto C, auto x) { return find(begin(C), end(C), x) != end(C); };
cout << contains_x(vec3, 25) << endl;

Once again you can witness how elegant Python is. It is the most straightforward way and even non-programers would understand what this code do.

g) check if all values are smaller than y.

Python:
if all(v < 30 for v in values):
    print("All values are smaller than 30!")

C++:
// solution 1
int twojaWartosc = 4;
auto wart = std::find_if(kolekcjaA.begin(), kolekcjaA.end(), [&twojaWartosc](auto const &x) { return x < twojaWartosc; });
std::cout << "Wartosc : " << *wart << std::endl;

// solution 2
int y = 50;
cout << all_of(begin(vec3), end(vec3), [=](auto x) { return x < y; }) << endl;
// solution 3
auto less_y = [](auto y) { return [=](auto x) { return x < y;  }; };
cout << all_of(begin(vec3), end(vec3), less_y(20)) << endl;

Python is clean and simple. In C++ you can use different ways, but even this simple task can cause problems - solution 1 throws exception when the value is not in the collection as you try to access (dereference) an iterator that point to the end of collection.

6) having a text count how many letters are lower-case and how many are upper-case

Python:
number_of_uppercase_case = sum(1 for c in text if c.isupper())
number_of_lowercase_case = sum(1 for c in text if c.islower())

C++:
// solution 1
int male = std::count_if(podanyTekst.begin(), podanyTekst.end(), [](unsigned char x) { return islower(x); });
int duze = std::count_if(podanyTekst.begin(), podanyTekst.end(), [](unsigned char x) { return isupper(x); });

// solution 2
cout << count_if(begin(s), end(s), islower) << endl;
cout << count_if(begin(s), end(s), isupper) << endl;

All the solutions are very similar - they use built-in functions. The thing with Python is that you can use almost the same code for other things like e.g. extraction of lower-case letters:

lower_case_letters = [c for c in text if c.islower()]

7) is there any situations that you do not use indentation?

We all have agreed that apart of code golfing everybody should use indentation. So if it is obligatory lets resign from { and } brackets. Their are unneeded and deprecated. Lets use Python!

8) are you using standard arrays (static or dynamic) at all (like: int a[5] or int* b = new int[5])?

Once again we had a consensus - dynamic tables should be avoided as they can be dangerous.
When I think about them two quotes comes to my mind:

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.

-- Bjarne Stroustrup

With great power comes great responsibility.

-- Voltaire

Other

On a side note - this is probably the longest most in my career.
If anybody is interested I used Syntax highlighter to post the code. It offers nice looking code but embedding small portions of code is cumbersome - you have to edit html code and doing it through the browser is a pain.

Summary

I hope you enjoyed this long, over 9000 signs comparison. By no mean I was trying to defame C++. I think it is an important programming language, that has its uses (C for microcontrollers, some high performance routines and libraries). Just in my opinion the new additions to C++ (C11, C14) that tries to convert it to modern programming are a failure. They change many things upside-down, make the code much different to understand for people that are not familiar with new standards while the code is still not as elegant and readable as Python. It is just my two cents, opinion that is probably heavy influenced by my experience - I did a lot of programming for embedded systems (microcontroller based).



If, by some accident, you are still not convinced about Python greatness you are not alone. Apparently some people think Python is overrated ;)

TL; DR

This post describes why I think Python is a great language, especially when you are starting learning how to program. Different simple exercises were done in both Python and C++ and the code was compared. Python rulez.

Wednesday, December 30, 2015

I became a Python zealot!

Some time ago I started solving coding puzzles from codingame webpage. I mentioned it in a previous blog entry. I am doing all the puzzles in Python as a way to learn this language. Currently I have done all easy, all except one medium, half of hard and half of very hard. You can find solutions on my github account.

Thing that I would like to share with you today my dear reader is my findings about Python language.

Let me give you some background:

I learned some basics Pascal in a high school (using the Free Pascal IDE, yes the blue one pictured below!) and created a master mind game (you can admire this marvellous piece of work here).


Then I started my studies - Control Engineering and Robotics and learned C and C++. It was during medieval ages, harsh and dark times without vectors, list and all other shiny things kids play with these days. I prepared my own double-linked list, stack, queue through the pain and hard work.

On a second year, way before it was introduced on lectures I started working with microcontrollers and after short stint using asembler (I still have one of the programs I wrote, check it HERE) I switched to programming them in C. At that times the mighty AVR Studio 4 was considered a state of the art IDE, with no code completion and ugly looking font! All of this skewed me away from the objective C++ and made me favour C.

After the second year of studies I started additional field of studies - Computer Science. There I have learnt that C# is a great way to write programs with windows, buttons and so on. I also got to know collections, generic types and a world without pointers. On the other hand I was introduced to image processing library called OpenCV (during glory days of C api with IPLImage and manual memory managment <yay>). What is funny is that you can still found a lot of advices and code examples related to old OpenCV APIs. During that times I just coded - if there was a task, I did it, did not have any favourite language - I used what was best suited - C for micros, C++ for image processing, C# for windows apps. I did not know about unit tests, refactoring, clean code theories, version control systems (!) and other things. There were just problems that had to be solved. If the problem was small enough I was able to finish it fast, if it was rather large I was suffering because of my unawareness of  proper code management techniques. I drifted far away from the main point that I was planning to make - during all that time I did not find my go to language.

Diving into Python

Last year a friend (thanks a lot Marek!) convinced me to try Python. At the beginning I was sceptical as I thought that the same thing can be achieved with C# or C++ with heavy usage of standard library (especially with new things from C++11). Boy I was wrong! During this year I wrote some programs with Python:
and solutions for codingame puzzles:

After the last one especially I came to conclusion that Python is a great language to start your programming journey. This is somehow important to me as I am teaching programming at the Poznan University of Technology. Earlier, I was teaching students how to solve problems using C/C++ programming language and I did it with passion. Nowadays I am doubting if it is the best way and it is because of Python. I tried to convince my colleagues about Python superiority but they are stubborn so I will try to convince YOU, the reader. Try solving following problems in C++, while I will do them in Python and we will compare the solutions in the instalment of this series (I sent the questions to a few friends and if they accept I will post their solutions too). Here we go:

* you can use any collection you find appropriate for the task (vector / list / other). Same goes for strings / arrays of chars.

1) lets assume we have to collections and would like to print values in the following format:
value_0_from_first_collection, value_0_from_second_collection
value_1_from_first_collection, value_1_from_second_collection
etc

2) lets assume we have a text and we would like to print it without the first and the last sign. In addition print text length.

3) we have a collection of values and we would like to prit it without the first and the last value. In addition print collection size.

4) we have a function that has to return:
a) two values,
b) three values.
How would you implement that?

5) for collection of your choice do:
a) print all values,
b) increase each value by 10,
c) remove last element,
d) remove n-th element,
e) print value alongside its index,
f) check if value x is in collection,
g) check if all values are smaller than y.

6) having a text count how many letters are lower-case and how many are upper-case

7) is there any situation that you do not use indentation?

8) are you using standard arrays (static or dynamic) at all (like: int a[5] or int* b = new int[5])?

TL; DR

My programming history was presented. It is full of entertaining and absorbing adventures (who would contempt some asembler and pascal code!) that you should read carefully. Also Python is the thing right now. At the end I ordered you a homework that you have to do and post the solution in the comment section below!