CodinGame: How I Left Without a T-shirt

    Preamble

    My name is Ruslan and I am an alcoholic programmer. I have not come across "sports programming" long ago. The last time it helped me go to 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 crashed and presented surprises, and now we have learned not to deploy on Fridays, we have learned how to deploy on Fridays so that nothing breaks and does n’t fall and hardly surprises. In general, once, in order not to be bored, I worked on my small projections, then a little freelance, and at the beginning of this year I was ordered to remember about the Olympics about programming and sports programming.

    And the title does not quite correspond to the text of the article, but I really liked it. If someone decides to read an article to see me without a T-shirt, don’t do it!

    About CodinGame

    Codingheim is an online programming competition platform. There is an online editor, automated testing of the program, and even some prizes. Before the competition (held once a month), it is proposed to tick off interesting employers (they are mainly French), suddenly one of them wants to take me to work. I am not looking for work, but following the results of several companies asked to send a resume. Although the results are more than modest. Today I found the item, "I'm participating For fun." Next time I’ll use it.

    In addition, gifts are given to the winners. For example, onThe next competition (in a month) in gifts will be: iPhone, robot and drinks machine. 10 T-shirts for the 10 best solutions, and a T-shirt for the leader in each programming language (and about 20 are supported).


    Briefly about my successes, failures

    The first pancake turned out to be quite lumpy for me: probably, no matter what I start to write, anyway an online game is obtained. In general, it was too difficult to write.

    The second time was more fun. Firstly, I took Groovy instead of Java as the language. Programming has become more convenient and faster. In addition, it turned out that the best programmer in every programming language has a T-shirt. And in a couple of weeks, a T-shirt flew to me on the wings of the Russian Post. The competition among those choosing Groovy is not as tough as among Java or C ++ users.

    The third time was today. I passed the task 4 seconds later than the opponent with the same result. Today I got only impressions, which I decided to throw out on Habr.

    About today's competition I

    will briefly describe today's competition. Input: field, goals and “walls” on it, several bombs and several moves are given in order to lay them down. It is necessary to destroy all the goals.

    In general, solving programming problems for me comes down to solving a problem in my head. I thought and decided that in order to destroy all targets, it is necessary to find a cage, a bomb from which will destroy the maximum number of targets. Repeat until the target or bombs run out. In the third round - a mistake. Debugging the code, it turned out to be a minor technical blot, mixed up Math.min and Math.max. I’ll start further, the task “to foresee the future” is disrupted.



    You need to plant a bomb on the site of the detonated target. I thought and wrote that if there is a margin of time, you just have to wait, not plant a bomb. As a result, only one task was not completed. In it, you need to plant a bomb in the wrong cell from which the largest number of targets explode:



    I wanted to write a separate check to see if it is possible at this time to put all the bombs on hand in such a way as to detonate all the targets, but there was little time left, and I did not do this. Although it would be worth it. The reason is the most unsportsmanlike, I wanted to be the first to pass the Groovy code.

    CodinGame has available puzzles for training , most likely soon (like in a couple of weeks), today's task will appear there.

    What would I recommend to other participants

    • I think Codingame is a good way to try some other language. For example, someone solved these tasks on Bash! Next time I want to try on Go;
    • If someone has not tried himself in "sports programming", it may be worth a try;
    • It is convenient to write debugging in stderr;
    • My first pancake would have worked out better if I had first trained in test tasks;
    • For fans of “hacking the system" and "unsportsmanlike behavior." Since testing is automatic, perhaps the fastest solution is to hardcode the answers. I have not tried and will not, but it should work out;
    • Better ask someone who ate the dog for advice, not mine.


    And a miserable babble of excuse ...

    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 to complete the task (in general, 3 hours were allotted, but I was late for the start). 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 got for the second competition looks like this:



    PPS And for those who did not like CodinGame, there is still TopCoder .

    Also popular now: