UPDATE: The contest is over.
ResultsHola announces a long-awaited summer programming competition! Winners will receive prizes:
- First place: 3000 USD.
- Second place: 2000 USD.
- Third place: 1000 USD.
- If you send someone a link to this contest, putting our address in CC, and this person will take the prize, you will receive half of the prize amount (of course, not to the detriment of the winner’s reward). For one winner, only one person can receive such an award - the one who sent the link first.
Authors of interesting decisions will be invited for interviews.
')

rules
Competition terms in English are posted
on GitHub . Below is a translation into Russian.
- Submit solutions using this form . No decision is made by email.
- Decisions are made until August 17, 2017 , 23:59:59 UTC.
- Preliminary results will be published on August 24, 2017 , and the final announcement of the winners - August 31, 2017 .
- You can send solutions repeatedly, but each participant will only consider the most recent decision sent before the deadline for accepting work.
- For testing, we will use Node.js v8.1.3 (the current version at the time of publication). You can use any language features supported by the interpreter in the standard configuration.
- All solution code should be in a single JS file .
- The solution should be on JS. If you prefer CoffeeScript or similar languages, you need to broadcast the solution to JS before sending it.
- If your JS file is a product of generation, minification and / or compilation from other languages ​​like CoffeeScript, please attach the archive with the sources, and also, preferably, with a description of the approach. The contents of this archive will be published, but we will not test it.
- You can not load any modules , even those that come standard with Node.js.
- We need to know your full name, but if you want, we will publish a pseudonym instead. We will keep your email address confidential.
- Ask questions about the problem statement in the comments to this publication or by e-mail .
Jsdash
Let's play a text game! Undoubtedly, you recognize in it a clone of the classic video game, first published in 1984.
Your goal is to write an artificial intelligence that plays this game, making decisions instead of a person. The game will take place in real time, and your script will have as much decision time as a person.
We recommend running the
game / jsdash.js script and playing the game several times before reading further. (Note: we developed and tested the xterm game on Linux. On other systems, it may or may not work.)
A game
Arrow keys can be moved in four directions. The green letter
A
is you. You can move through empty space or earth (
:
, push stones (
O
) horizontally into empty space and collect diamonds (
*
). It is impossible to pass through the bricks (
+
) and steel (
#
). Stones and diamonds fall when left without support, and also roll sideways with each other and with bricks. Falling objects kill the player. Butterflies (animation
/|\-
) explode upon contact with the player, from a hit by a falling object, as well as being locked without movement. The butterfly blast absorbs any materials other than steel and can kill the player. After the explosion diamonds are formed, which can be collected.
For each diamond taken, 1 point is awarded. If you collect 3 diamonds with intervals of less than 2 seconds, in addition to points for each of them, 3 bonus points are awarded. If you continue to quickly collect diamonds, without making intervals of 2 seconds or longer, you get 5 points after the fifth diamond, 7 points after the seventh (in addition to all previous prizes), and so on for each prime number. 10 points are awarded for a killed butterfly, provided that the player is not killed by an explosion.
The game time limit is 2 minutes. You can interrupt the game earlier by pressing Q, Esc or Ctrl-C; points are not lost. The P key allows you to pause the game.
The rest of the time, points and messages about prize chains (hot streak) are displayed in the status bar under the playing field.
The mechanics of our game as a whole corresponds to the 1984 model (it is known for its detailed description on
the Boulder Dash fan site ), but for simplicity, we decided not to use all types of objects. The biggest differences are the points scoring system described above and the fact that there is no way out at the level. The goal of the game is to score as many points as possible before the game ends with the death of a character or after a time. If you are interested in the details of the game mechanics, read the source code of the
game.js module.
Solutions
The solution is a Node.js module without dependencies. The module must export one function:
play(screen)
The game will load the module and call the
play
function once, passing the initial state of the game as a parameter to the
screen
. It is an array of lines, one for each line of the screen from top to bottom, including the status bar. The lines will contain exactly what you see on the screen, only without coloring in ANSI colors (the game can be seen in this mode on the console, if you start it with the option
--no-color
). The
play
function must be a generator. To make a move, it must generate (yield) the value of
'u'
,
'd'
,
'r'
or
'l'
to move up, down, left or right, respectively. You can also generate
'q'
or simply complete the generator (return) to finish the game ahead of time (no points are scored). If you generate any other value, it means the move "stay in place." Trying to go in a direction in which it is impossible to move (for example, into a wall) is not prohibited: the character will simply remain in place. After each yield, the contents of the
screen
array are updated, and your code can analyze it again to make further decisions.
If your function causes an exception, the game will end with a score of 0 points. This will not prevent your program from playing and gaining points at other levels.
Your script will run in a separate process. Even if he hangs, it will not slow down the game (while the character will stand still).
The game state is updated every 100 ms. If the
play
function will generate commands faster, the character will move 10 times per second. After each command, the generator will be blocked on the
yield
instruction until the end of the 100 ms length. If the function “thinks” over a move longer than 100 ms, it starts to skip moves, and then the character will remain in place during those rounds when the function did not have time to make a move. In this case, the generator will also not see some intermediate screen states. For example, if the script "thinks" for 250 ms between two
yield
instructions, it will not see two screen states, and the character will remain fixed for two rounds; thus, two opportunities to make a move that would have been if the program had run faster would be missed. After that, the generator will be blocked for 50 ms until the end of the round, and the command it has generated will be executed.
A very simple example of a working AI script is provided in the
game / example.js file. Each round, he finds all possible moves (directions in which there are empty space, earth, a stone that can be moved, or a diamond in the neighborhood of the player’s position) and selects one of them randomly. Usually this script is killed soon after the start of the game.
Testing
The
jsdash.js script that we provide on GitHub is not only an interactive game, but also a powerful tool for testing. Run it with the
--help
parameter to learn about all its features.
Each solution sent to us will be launched on at least 20 automatically generated levels. The participant whose decision will score the highest amount of points at all levels will be recognized as the winner. We reserve the right to increase the number of levels (for all participants) if this is necessary in order to eliminate the "draw" between the leaders; if this does not help, the one who sent his decision earlier will win.
When testing each solution, the same set of seed values ​​for the pseudo-random number generator will be used, so that the programs of all participants receive the same levels. When launching your solutions we will use the default settings:
jsdash.js --ai=submission.js --log=log.json --seed=N
However, we recommend paying attention to the entire set of available command line parameters that can help you in debugging.
At the end of the competition, records of games of each solution will be published at each of the test levels. These recordings can be played with the following command:
jsdash.js
Testing of all solutions will take place on the
c3.large virtual server (see the hardware specifications here) on Amazon AWS running Ubuntu 14.04 (amd64). Solutions will be tested one by one with no other load on the machine.
We fix bugs in the test script, which we are informed about by the participants. Stay tuned to the
game / CHANGELOG.md file !
Sending Solutions
To send solutions, use the
form on our website . Email decisions are not accepted!
Since the decision code is often generated, minimized or translated from another language, the form also contains a field for sending an archive with source tests. If the code is generated, turn on the generator; if it is minimized, turn on the original version; If the code is translated from CoffeeScript or another language, include the code in the language in which it is written. It is also advisable to include in the archive a README file with a brief description of the approach to the solution (in English). The archive must be in the format tar.gz, tar.bz2 or zip. The contents of the archive will be published, but will not be tested (we only test the JS file that you send outside the archive).
The maximum size of the JS file is set to 64 MiB. This is an arbitrarily chosen number, which exists mainly so that someone’s “solution” does not simultaneously fill us with a disk. If your solution is true more than 64 MiB, write to us and we will increase the limit.
If you have questions about the condition of the problem or problems with sending a solution, please write a comment or
letter .
Good luck to all participants!