πŸ“œ ⬆️ ⬇️

Updated Codebattle: a game for programmers

Hi, Habr!



Three weeks ago, we (the friendly team of the educational project Hekslet ) published a post about our new project - a game for Codebattle programmers. Let me remind you, the idea of ​​the game is very simple: you and your opponent are given the task, you solve it in your chosen language. You can see the opponent's code in real time, test run results and can chat with him and the audience in the chat. Whoever solves the problem first (satisfies the tests) won.
')
After the publication of the article we had a fun day. Went under a habra effect and found several bugs. When the storm calmed down, life began to boil again in the arena. Over the next two weeks, we solved three main problems: productivity, the fight against cheating, and the ability to quickly add new languages. And they decided!

Meet the updated Codebattle ! In short:

  1. Habraeffekt us is not terrible (pah-pah-pah)
  2. Cheat will not work anymore (you can not adjust the solution under the tests)
  3. It has become easier to add languages ​​(now there is already clojure, ruby, js, python, php, java, erlang)

Details under the cut β†’

Why lay and how decided


We worked through polling, which generated thousands of requests per minute. Now all rewrote through websockets. There was also a bug in the nkdocker library.

Cheating and languages


In the previous version there was such a system:
  1. We write the task and tests for Clojure
  2. We broadcast on target languages ​​by our library multicode .
  3. We show the generated tests to the player.

Naturally, there were people who simply customized the code for the tests without solving the problem itself. In addition, this scheme complicated the addition of new languages.

In the updated version, there is another scheme: we simply work through standard stdin / stdout I / O streams, and are not tied to a specific language. Now we generate tests when checking and do not show them to the player. The system has become much simpler: we simply submit the generated data to your program and look at stdout. This also allowed us to simplify the addition of new languages, we managed to add Clojure, Java and Erlang.

From trifles: added a handful of new tasks, updated the description in all tasks, updated the extension for Chrome .

How to add a new task

Do you want to add a new task to the database and upgrade to Clojure? ;-) In our repository with tasks there is a detailed README and illustrative examples.

In our Slak-chat there is a special channel #codebattle where you can discuss games, problems and ideas.

Source: https://habr.com/ru/post/269613/


All Articles