PreambleMy name is Ruslan and I am an
alcoholic programmer. I haven’t come across “sports programming” for quite a while. Last time it helped me to go to the university, which I never finished. I have been developing games for almost 9 years in a row. At first it was interesting to work. The server often fell and gave surprises, and now
we have learned not to deploy on Fridays, we have learned to deploy on Fridays so that nothing breaks fall and almost no surprises. In general, once, in order not to be bored, I was engaged in my little projectors, then a little bit of freelance, and at the beginning of this year I managed to remember about programming competitions and sports programming.
And the title does not quite match the text of the article, but I really liked it. If someone decides to read the article to see me without a t-shirt - do not do that!
')
About CodinGameCodingheim is an online platform for programming contests. There is an online editor, automated program testing, and even some prizes. Before the start of the competition (held once a month), it is proposed to tick off interesting employers (they are mostly French), if anyone of them wants to take me to his job. I am not looking for a job, but following the results several companies asked me to send a resume. Although the results are more than modest. Today I found a clause, “participating For fun”. Next time I'll take advantage.
In addition, the winners are given gifts. For example, in the
next contest (in a month) the gifts will be: an iPhone, a robot and a drink machine. 10 T-shirts for the top 10 solutions, and a T-shirt for the leader in each programming language (and there are about 20 of them supported).
Briefly about your successesMy first pancake turned out to be a lump: I’m surely that I’m starting to write, it’s still an online game. In general, it is too difficult to write.
The second time was more fun. First, I took as a Groovy language instead of Java. Programming has become easier and faster. In addition, it turned out that the best programmer in each programming language put a T-shirt. And in a couple of weeks, a T-shirt came to me on the wings of the Russian Post. Competition among those who chose Groovy is not as tough as among Java or C ++ users.
The third time was today. I passed the task 4 seconds later than my opponent with the same result. Today I got only impressions, which I decided to throw out on Habr.
About today's competitionI will briefly describe today's competition. Input data: a field, targets and “walls” on it, several bombs and several moves are given in order to lay them. It is necessary to destroy all the goals.
In general, the solution of programming problems for me comes down to solving the problem in my head. I thought and decided that in order to destroy all the targets, it is necessary to find a cage, a bomb from which will destroy the maximum number of targets. Repeat until you run out of targets or bombs. In the third round - a mistake. I debug the code, turned out to be a small technical blot, confused Math.min and Math.max. I start further, the task "to foresee the future" is broken.
![](https://habrastorage.org/files/165/3b3/29c/1653b329c27143628756d585ed622199.jpg)
You need to lay a bomb on the site of the exploded target. I thought and added that if there is enough time, you just have to wait, and not plant a bomb. As a result, only one task was not completed. It is necessary to plant a bomb in the wrong cell, from which the most targets explode:
![](https://habrastorage.org/files/ed2/91b/4f6/ed291b4f6bdd4ffd863b74329ac7e7e1.jpg)
I wanted to write a separate check whether it was possible at the moment to put all the bombs in my hands in such a way as to blow up all the targets, but there was little time left, and I did not do that. Although it would be worth it. The reason is the most unsporting, I wanted to be the first to pass the Groovy code.
CodinGame has
tasks for training , most likely soon (seemingly in a couple of weeks) the task will appear there today.
What would I advise other participants- I think Codingame is a good way to try some other language. For example, someone solved these tasks for Bash! Next time I want to try on Go;
- If someone has not tried himself in “sports programming,” it may be worth a try;
- Debugging is convenient to write to stderr;
- The first pancake I would have been better if I had first practiced on test problems;
- For fans of "hack the system" and "unsporting behavior." Since testing is automatic, perhaps the fastest solution would be to hard-code answers. I have not tried and will not, but it should work out;
- It is better to ask the advice of someone who ate the dog on this, not me.
And the pitiful babble of justification ...While I was thinking how best to write that I was in a hurry today, these words of Lermontov came to mind. It so happened that I had a little more than an hour on my assignment (in general, 3 hours were allotted, but I was late to the beginning). Saturday, evening, and probably the last warm day off this year. That's what I need! 87 place
PS And the T-shirt that I received for the second competition looks like this:
![](https://habrastorage.org/files/ec1/380/201/ec13802017ca4c8595aba15dba69055a.jpg)
PPS And for those who do not like CodinGame, there is still
TopCoder .