UPDATE: The
results of the competition are published.
Hola again announces a JS programming contest with a solid prize pool:
- First place: 1500 USD
- Second place: 1000 USD
- Third place: 500 USD
- Perhaps we will decide to mark someone's extremely original decision with a special prize of 350 USD.
- If you send someone a link to this competition, putting our address in the CC, and this person will take the prize, you will receive the same amount as he.
We are looking for talented programmers, so authors of interesting decisions will be invited for interviews.
')

rules
Some of those who remember our previous contests were unhappy that the conditions of the tasks were not clearly formulated, and the participant was required to "guess" what we had in mind. This time the condition is formulated very clearly, and at the disposal of the participants - the reference implementation of the solution. Wins the one whose code will be the fastest, subject to passing tests for correctness.
Competition terms in English are posted
on our website . Below is a translation into Russian.
- Send solutions to challengejs+habrahabr@hola.org .
- Decisions are made until December 25, 2015 , 23:59:59 UTC.
- Winners will be announced on January 8, 2016 .
- You can send solutions repeatedly, but only the most recent solution will be reviewed from each participant, sent before the deadline for accepting work.
- For testing, we will use Node.js v5.0.0 (a stable version at the time of publication).
- Your solution should consist of a single JS file .
- The solution should be on pure js. If you prefer CoffeeScript or similar languages, you need to broadcast the solution to JS before sending it. We welcome (but do not require) sending the original together with the result of the broadcast (but not instead ).
- You can not load any modules, even those that come standard with Node.js.
- We will test solutions for correctness and performance. Only solutions tested for correctness will be approved for performance testing. Wins the fastest of the correct solutions.
- All works of the participants, as well as our tests for correctness and performance, will be published when summing up.
- To summarize, we will publish your full name (or pseudonym, if you subscribe to them), but not an email address.
- It is forbidden for participants to publish their decisions until the end of the competition. Violators will be disqualified.
- If the condition of the problem seems ambiguous to you, test your understanding of the condition with the help of our reference implementation (see below), instead of asking questions about the condition. If you find that the behavior of the reference implementation contradicts the condition, please let us know .
Formulation of the problem
You are developing a filter application system for the mail system. You need to write a module for Node.js that exports one function:
filter(messages, rules)
messages
— , : from
to
. .rules
— : from
(), to
() action
(). .
ASCII
0x20
0x7F
.
, ,
from
to
, . ;
*
(0 ) ,
?
— .
from
to
,
*
. ,
from
to
, .
, , .
filter
, .
action
, ,
rules
. , .
filter
:
filter({
msg1: {from: 'jack@example.com', to: 'jill@example.org'},
msg2: {from: 'noreply@spam.com', to: 'jill@example.org'},
msg3: {from: 'boss@work.com', to: 'jack@example.com'}
}, [
{from: '*@work.com', action: 'tag work'},
{from: '*@spam.com', action: 'tag spam'},
{from: 'jack@example.com', to: 'jill@example.org', action: 'folder jack'},
{to: 'jill@example.org', action: 'forward to jill@elsewhere.com'}
])
filter
:
{
msg1: ['folder jack', 'forward to jill@elsewhere.com'],
msg2: ['tag spam', 'forward to jill@elsewhere.com'],
msg3: ['tag work']
}
filter
http://hola.org/challenge_mail_filter/reference. . ( ). , , . , , ,
.
, 10 10 . .
HTTP- POST
application/json
. :
messages
rules
, —
filter
. , JSON, , . HTTP 400
text/plain
.
!