Solution to Problem D – Dumb clicking
The easy subproblem is pretty straighforward, since the rectangles and squares do not move. But there are several gotchas which you could encounter:
- The instruction for the first level is not in easy-data.js but in the html source.
- Some of the later levels have two commands instead of one.
- After the last level you should write “done” instead of “next” (not after “next”).
The hard subproblem adds some more tricks on top:
- The source code for game is minified.
- There is a timestamp in the logs. And also instructions about waiting between clicks. And on top of that, you are required to produce valid timestamps that all lie within the duration of the contest (more precisely, between the beginning of the contest and the moment when you submit). The grader rejected submissions with timestamps outside this range. One side effect of this check: it was impossible to submit D2 during first half hour of the contest.
- The squares and rectangles are changing positions. To handle this, you can either read the game’s source code to find the pseudorandom algorithm, or let it generate the levels and then query the generated image to find which shape is where. We find the second option much easier.