Saturday, October 17, 2015

Codingame - fun way to hone your programming skills

Some time ago a friend show me a webpage where you can polish you coding skills while having fun!

There are a lot of sites that offer programming tasks / exercises. Usually you get the instructions and when you have prepared the solution then you can upload it as a source file. It is then tested and at the end you are provided with the information about the results of you program (if it work as it should or if it does not work).

The main advantages of CodinGame site are:
  • number of languages accepted (23),
  • online editor with autocomplete function and three styles (e.g. Vim / Emacs),
  • well defined tasks with a lot of well-thought out test cases,
  • the ability to debug your program round by round,
  • fancy and nice looking graphics and animation (I know that it is not the most important part, but it makes solving the task more appealing, especially to begginers) alongside console output to help with the debug process,
  • achievements ;)
You can visit the site by clicking the image below:


The site offers few types of competition:
  • single player puzzles,
  • multi player,
  • optimization,
  • online clashes,
  • live contests.
Today I will focus on the first type - single player puzzles. This is the oldest feature of the site and there are 52 puzzles with different difficulty levels. On each of the level you get the task description, which states what the program has to do alongside with detailed information about  the input that is provided and the output expected. Usually some initial information is given at the beginning and then the puzzles are played in turn-by-turn way - you are given current state and have to provide the output - your action. For each task there are well defined test cases that starts with very simple ones, that can often be passed with simple, naive solution. Each test is more and more difficult and checks your program against different input data (edge cases) or tests performance of your code (so that you use something more refined than bruteforce solutions). In addition to this some of the puzzles has graphic animations of what is happening so it feels like you are playing a game and in the end you even get achievements! What is even better - it can land you a job!

 All in all I can wholeheartedly recommend the CodinGame website for both the advanced programmers and to beginners. Great way to improve coding skills while having fun!

Also you can find my solutions on my github:

https://github.com/Michal-Fularz/codingame_solutions

at the moment I have all easy puzzles done in Python (2.7.x). Some others (medium / contest /clash of code) are work in progress. Please take into account that I am learning Python language currently. If you find errors or non-pythonic code let me now. I would like to improve my Python skills as I enjoy the language a lot. 


TL; DR

CodinGame is a webpage with coding puzzles done right - they are interesting and fun to do. Also you get achievements on your way and can even get a job!

Wednesday, July 8, 2015

The Witcher 3: Wild Hunt review

I'm a gamer. I play computer games and watch esport (people competing in computer games, like in sport, but using the computer, you know) in my free time.

Some time ago a third instalment of a Witcher series was published. I bought it last year on gog.com (great, great and one more time great, site! Go and buy something there, its full of games from our youth!). This game and a busy schedule at of work are the ones to blame for lack of posts. What's funny is that despite over 70 hours I still didn't finish it! This short review is my way of getting back to regular updates!

Settings:

I'm playing the PC version using an Xbox gamepad. Most of the graphics settings are set to high with Nvidia Hairworks turned off.
Graphics:
The most talked topic about graphics of the Witcher 3 (especially on PC) is the DOWNGRADE... I don't care that much about  it cause the gameplay is the most important part IMHO, but the topic is interesting from technical point of view. Looking at some comparisons  it is clearly visible that the devs didn't take the heat for nothing. Because of low computing capabilities of current gen consoles (relatively to the mighty graphic cards available for PC) a lot of games is prepared in a way that they are playable on both the PC and consoles and does not differ too much in visual department (also why implement some sophisticated effects that works only on a smallest platform?).

For me the visuals are OK, the game looks great (I rarely play graphic intensive and new games). As always there is room for improvements, but the overall subjective (my!) opinion is that it's the best looking game I played :)

The world:

Andrzej Sapkowski (the guy that wrote books that the game is based on) created a magnificent world - it's complicated, with more shades of gray (pun not intended!) than white and blacked summed up. There's a lot of hatred, prejudice and ignorance. People are caring for themselves and and nothing more, cruelty and envy is common. I would say that the setting is rather depressive, but I love it (currently reading all the books again!).

I was a little bit afraid of the open world - I loved Witcher 2 for its closed, rather small area. I was able to search every inch in reasonable time and I like / feel the urge to explore every little corner. That's why Skyrim was too much for me, it was overwhelming. I travelled to the first city, took some quests, checked some buildings, than run somewhere, and out of nowhere some mountain giants is throwing me in the air... Decided to run in other direction, found some dungeon, searched and found out I can't kill the end boss. Had to go back the same route, run in different direction... Then I learned that I can have my house and so on... Waaaay to much for me to handle. On the other hand I liked the batman games (Arkham Asylum and City) - it was interesting main story + some additional content, which does not felt necessary to do (riddles).  Going back to the Witcher 3 - the world is huuuuuge and is filled with interesting places and quests to do. There are no: "The goblins stole my precious potato, go and get it back for the sake of my ancestors... blablabla". Most of them avoid being general fetch quests and usually offers nice story and some detective work to do. Each and every is well written and offers something - a lot of lore is hidden in those quests and you can learn new facts about the world. The main story is interesting, but I would rate Witcher 2 higher (the decisions in Witcher 2 were harder to make).

Fighting:

The fighting is responsive and fun. It consist of a few moves - dodge, roll, fast/strong sword attack, parrying, magic signs and bombs. Most are executed well  but after some time I found fights a little bit repetitive (probably because I play too much). I would rate Kingdoms of Amalur (more satisfaction), Batman (so easy to do cool things) and Sleeping Dogs (those combos) fighting systems a little bit higher, but only a little. They gave more satisfaction and were easier to execute, but the multitude of actions and the need to dodge/parry most hits (the monsters hit hard in this game) is really suitable to the Witcher settings.

RPG elements (level, items):

The skill system is original and interesting. On one hand it offers a lot of different options, but on the other hand it limits you which ones you want to use at the moment. It's not typical action RPG system (like Diablo 2), it has its own depth and I would say it is well balanced. There's also a way (pricey) to reset your skills if you went wrong way.

As skills are well designed the inventory is not. It's terrible! No storage space for you to hoard all the unique weapons and other stuff (books / crafting materials / alchemy ingredients). I quickly ended with the inventory filled up with stuff and Geralt overweighted and slowed down. WHY? I just don't understand the decision making behind it. In addition to very limited space the world is filled with items to pick up (food and drinks lying everywhere, can't resist taking it all). Fortunately the community has prepared the solution - weight mod. Go get it and don't worry about overweight any more.

Other:

The game has some minigames in it and one of them (the Gwent card game) is really fun to play. Add some more cards, better AI and it can be a standalone title!

It's very sad that this will be the last time we roll with Geralt (as developers said). There is possibility for next game in series but the lovely Geralt won't be the protagonist. So use it to the fullest and explore the wonderful grim world of Witcher 3.

TL; DR

The Witcher 3: Wild Hunt is great game with nice graphics, immersive atmosphere, interesting and full open world, great quests, good RPG elements and horrible inventory system. Despite some minor problems and great but not the best in the industry elements (fighting / skills) it's well executed and very addictive game. All in all I rate it:
10/10!
It is a must-play for any gamer.

Monday, April 13, 2015

Device drivers for bare metal Xilinx Zynq (C / C++)

Once again evil, technical part of me strikes!

This time I'm comparing the process of writing device drivers in both C and C++.

http://www.vision.put.poznan.pl/?p=246




Big props to my homie Marek for much needed proofreading!


Thursday, March 26, 2015

Using C++ for bare metal Xilinx Zynq applications

Long time no see Boyz and Gurlz!

You can find my new writing (this time it's technical one) here:

http://www.vision.put.poznan.pl/?p=182



Lately I was thinking about changing the topics covered by the blog, which is the reason why there were not post for so long (vacation is second reason to blame). I'm planning to cover more technical topics (programming / FPGA / electronics / robots) instead of situational ones (running / motivation).

Cya!

Wednesday, February 18, 2015

Mercedes W168 - dziennik kosztów [PL]

Wstęp

Wpis powstał dzięki jednej z wielu moich bezużytecznych manii, tendencji czy nazywając rzeczy bezpośrednio - lekkiemu zaburzeniu psychicznemu. Mam skłonność do tabelkowania i archiwizowania danych, by potem je statystykować i podsumowywać. W ten sposób zebrałem wszystkie koszta związane z samochodem od momentu jego zakupu (2011.04.18) do chwili obecnej (2015.02.18, planuję nadal aktualizować).

Panie i Panowie, benzynogłowi (petrol-headzi?) i piesi, moja strata czasu (polecam puścić sobie TO):


Dziennik pokładowy pod zdjęciem, TAK należy je kliknąć, ewentualnie TUTAJ.

Dziennik pokładowy - informacje

Dziennik dotyczy samochodu osobowego marki Mercedes klasa A (model W168, rocznik 1998). Dokument składa się z kilku arkuszy, w zależności od typu wydatku tj.:
  • Podsumowanie - zgrupowanie wszystkich wydatków i innych danych z podziałem na lata.
  • Paliwo - wydatki na benzynę (poza jednym tankowaniem tylko "sportowe" PB95 lałem) z datą, ilością zatankowaną, ceną za litr, miejscem tankowania i czasem uwagami odnośnie trasy, stylu jazdy. Wyliczone jest średnie spalanie (zarówno za dany odcinek jak i ogólne).
  • Eksploatacja, naprawy - wydatki na naprawy, zakup części / wyposażenia, wszystkie inne.
  • Opłaty za przejazd, mandaty - opłaty za przejazdy autostradą, mandaty.
  • Stałe - opłaty za ubezpieczenie oraz przegląd techniczny.
  • Kupno - zakup samochodu i wszystkie koszty wstępne, również pierwszych napraw (nie sprawdziłem kilku rzeczy przy kupowaniu auta).
Polecam zajrzeć na zakładkę Podsumowanie, szczególnie kolumny zaznaczone kolorem. Ważne fakty (stan na 2015.02.18):
  • koszt jednego kilometra bez utraty wartości: 0,76 zł
  • koszt jednego kilometra z utratą wartości (zakładając, że samochód jest wart 0zł): 1,13 zł
  • liczba przebytych kilometrów: 28 876 km
  • liczba zatankowanych litrów paliwa: 2 246 l
  • średnie spalanie: 7,78 l / 100km
  • średnia cena paliwa: 5,42 zł / l

Ciekawostki:

  • Pokonywane trasy to głównie jazda do Wilkowic (około 87 km w jedną stronę) i Łęczycy (około 180 km w jedną stronę), okazyjne wyjazdy na wakacje (w tym jedna bardzo długa wycieczka do Belgi - ponad 1000 km w jedną stronę) i jazda po mieście (Poznań).
  • Samochód kosztuje nawet jak stoi w garażu - koszty stałe są nie do uniknięcia + długie postoje podobno też dobrze na auto nie wpływają. W moim przypadku koszty stałe to prawie 10% kosztu przejechania kilometra (bez utraty wartości).
  • Jak do tej pory pełne lata (poza 2011) kosztowały około 2000 +/- 200 zł za naprawy. Wydaje mi się, że to duży koszt zważywszy na liczbę przebytych kilometrów. Stanowi w sumie prawie 32% kosztu przejechania kilometra (bez utraty wartości).
  • W rozpisce tego nie widać, ale autostrady drożały z roku na rok, a dodatkowo stały się szczelniejsze (nie ma możliwości łatwego omijania punktów poboru opłat).
  • Benzyna była tania - średnio 5,13 zł/l (2011), następnie podrożała (do około 5,63 zł/l - 2012/2013) aby znów stanieć (5,17 zł/l - 2014).
  • Spalanie przez wszystkie lata było mniej więcej równe. Jeżdżę bardzo spokojnie i staram się jak najwięcej hamować silnikiem. Jak pożyczyłem auto to zdołało wypić raz prawie a raz ponad 9 litrów.

Porównanie

Od jakiegoś czasu kupuję magazyn motor i tam czasem ukazują artykuły pod nazwą "TEST DŁUGODYSTANSOWY", w którym przedstawiane aktualny stan i historia wydatków (bardzo ogólna). Oto wyniki (podaję numer magazynu, nazwę samochodu oraz koszty przejechania kilometra bez i z uwzględnieniem utraty wartości):
  • 30/2014: Citroen C4 1.6 HDi: 0,48 / 0,83 zł/km
  • 37/2014: Ford Fiesta 1.4 TDCi: 0,53 / 0,66 zł/km
  • 47/2014: Seat Leon 1.9 TDI PD: 0,58 / 1,00 zł/km
  • 51-52/2014: Volvo S80 2.5D: 0,47 / 0,74 zł/km
  • 2/2015: Subaru Outback 2.5: 0,73 / 1,61 zł/km (benzyna!)
  • 5/2015: Ford Mondeo Mk3 2.0 TDCi: 0,48 / 0,72 zł/km
Wyraźnie widać, że Mersio wychodzi drogo, szczególnie przy koszcie przejechania kilometra bez utarty wartości.... Przypuszczam, że da się to wyjaśnić - w przypadku Subaru test trwał 7 lat i przyjęto średnią cenę benzyny na poziomie 4,65, moje dane bazują głównie na 2012/2013, gdzie benzyna była najdroższa. Pozostałe auta miały silnik Diesla, tylko w jednym wymieniana była turbosprężarka i dwumasowe koło zamachowe, w pozostałych obyło się bez większych napraw, co rzutuje na niższe koszta użytkowania. Wszystkie testowane samochody były również o co najmniej 7 lat młodsze od opisywanego dziś bohatera :)

Czy opłaca się kupić i użytkować samochód?

Pytanie bardzo ogólne, a odpowiedź będzie ściśle powiązana z moją sytuacją - osoby, która do pracy maszeruje i w związku z tym jeździ mało. Przeglądając wydatki można łatwo dojść do wniosku, że korzystanie z PKP / PKS / komunikacji miejskiej czy taksówki będzie tańsze, co jest według mnie prawdą. Samochód to pewnego rodzaju komfort, za który trzeba niestety płacić.

TL; DR

Wpis przedstawia statystyki dotyczące kosztów użytkowania (napraw, ubezpieczenia) i spalania samochodu Mercedes klasy A (W168). Link do dziennika pokładowego - TUTAJ.

Monday, February 9, 2015

Mój samochód [PL]

Moja samochodowa historia jest krótka. Nie jest wieloletnią pasją, nic w ten deseń. W młodości i w czasach gimbazy (tak chodziłem do gimnazjum, zacny pierwszy rocznik tej nieudanej reformy), liceum i studiów moja wiedza o samochodach sprowadzała się do:
- mają cztery koła i silnik,
- steruje się naciskając stopami pedały, kręcąc kierownicą i machając jedną wajchą,
- służą do przemieszczania się z punktu A do punktu B.

Ok, może przesadzam, nie było tak źle, wiedziałem, że są biegi (coś jak przerzutki w rowerze ;) ), obroty silnika, że wlewa się benzynę itp. itd. W skrócie niewiele. Co ciekawe zdałem prawo jazdy za pierwszym podejściem. Ku mojemu zaskoczeniu bo w trakcie bardzo krótkiej jazdy egzaminator zwrócił mi dwa razy uwagę (nie, nie dałem mu żadnej koperty, domyślam się, że zobaczył we mnie wielki potencjał ;) ).

Całe studia i jakiś czas w odwiedziny do rodziców czy teściów jeździłem pociągiem. Nie było to takie złe, ale one zawsze się spóźniały, były przepełnione i inne nieprzyjemności (temat na inny post)...

Czasem pożyczałem samochód od kolegi (trzeba było jakoś jechać na większe zakupy). Parę razy tata mnie pytał czy myślę o zakupie samochodu i mówiłem, że czemu nie, ale bez znajomości branży i tematu żadnych poszukiwań nie prowadziłem. Pewnego słonecznego dnia tata zadzwonił i powiedział, że jeden Pan z jego pracy sprzedaje samochód i całkiem fajny i może obejrzymy. Jak powiedział tak zrobiliśmy i oglądając JEDEN samochód stałem się posiadaczem własnej FURY. I to jakiej:



Tak, mietek (model W168) w tym kolorze (uniwersalny srebrny), w najwyższej wersji wyposażeniowej (avantgarde) z najmniejszym silniczkiem benzynowym (pojemność dwa jeden czterysta, moc over 9000 thousand całe 82 kunie).

Ciekawe fakty: oblał test łosia, pierwszy Merol z przednim napędem i do tego taki mały (3575 mm).

Do teraz nie wiem jak to możliwe, że w przypadku przedmiotów o znacznie mniejszej wartości (telefon komórkowy, laptop, słuchawki, rower) potrafię spędzić tydzień lub więcej rozmyślając, czytając poradniki (fuj) / strony / fora (najtrudniej się dokopać, ale bardzo wartościowe rzeczy można znaleźć), a samochód tak od ręki zakupiony został...

Z niewiedzy paru rzeczy w nim nie sprawdziłem i potem to odpokutowałem u mechanika... Ale ta baja innym razem opowiedziana zostanie. Wiem jedno, teraz trochę się znam (tylko trochę i tylko teoria, bo ile można się nauczyć z gazet i internetu, ale przynajmniej odróżniam filtr FAP od DPF, twinturbo od biturbo i kompresora, a nawet całkiem dobrze znam język autokomisjański - pół-skóra, panorama, head-up, łopatki-f1, sport chrono, itp. itd. to ja wiem co to jest :D ) i następne auto będzie dobrze przemyślane i wybrane, a przed zakupem dobrze przetestowane pod każdym względem.

Póki co to pieśń przyszłości, bo "merc baby" służy mi do dziś. Czasem lepiej, czasem gorzej, ale na trasie jeszcze nigdy nie zawiódł (dużo nie jeździł). W następnym odcinku tej serii ujawnię pełną listę wydatków związanych z użytkowaniem tego samochodu i opiszę wszelkie dolegliwości i problemy! Pozdro sześćset!

Thursday, January 22, 2015

Useless hobbies and interests

Long time no see my dear reader! This post is special - it's dedicated to my rather new (6 months old) interest - cars. As cars prices, availability and specifications are rather local this post main part (about cars) will be presented in Polish (I also don't know the English vocabulary to write about cars... nor do I know general one to be fair).

Get down to business - useless interests - that's my problem. The Internet is full of (I mean totally, absurdly packed with) content and I'm susceptible to it. I love reading about stuff, be it new processors, new smartphones or other piece of junk gadget... Nowadays I read about cars, watch youtube viedos about cars, HOLY MOLY my time!!! New information about esport, YES PLEASE! Don't tell anybody but I've even read some lifestyle blogs...

Another example - few days ago I was talking with a friend about digital cameras and somehow mirrorless interchangeable-lens cameras were mentioned, I didn't know what it is so went to computer to check that. Then I learnt about types of cameras, how they are build, what is RAW file, how to convert it, different lens mount systems, how autofocus works and so on... When I looked away from monitor it was 3am :(

The worst part about it is that all the topics that absorbs me are useless for my job, they stop me from doing other, more productive things. They just keep me in front of the monitor and makes time flies. Is there a solution? If so... HALP ME!


But the sad truth is... it is probably incurable...

Now the promised part about the car (in Polish) - CLICK ME NOW (will be active tomorrow - 23.01.2015 FAIL... active on 09.02.2015)!