C# – Eggcellent – Painting on the console

Sometimes, you may see something that seems rather easy to be achieved, you have a vision in your mind regarding it and it still takes 5 times more time and patience to get it. Today, after taking a look at what seemed to be rather easy task with printing on the console an egg, I was pretty sure that I can come up with a working solution within 15 minutes.

The task was similar to the one with the boats, its logic and methodology was exactly the same, but still I needed about 1.5 hours of what seemed to be an easily digestible task. Quite funny, eh?


The question is why? First, I had problems with the fact that the vertical lines of the egg were not defined in size. I created some easy formula to define them, but it did not work with more than 3 of the types. Then, it seemed that it is not that easy to reverse the first part of the egg, and after some 30 minutes of trying to do it, I simply decided to build it up again from scratch. Thus, the code written by me became 144 lines, with about 60% of it a redundant one.

Considering the fact, that I have already spent some hours writing the code, I have decided to publish it anyhow, without further edition. Yes, it can be upgraded and improved, but for the sake of the fact that it gives 100% on the tests, it is quite OK. Brace yourself, here it comes:

So, that’s all 🙂

Tagged with: , , ,