skbkontur/icfpc2017-kontur-ru

Name: icfpc2017-kontur-ru

Owner: Kontur

Description: kontur.ru team @ ICFPC 2017

Created: 2017-08-10 06:41:32.0

Updated: 2017-08-30 05:53:04.0

Pushed: 2017-08-11 19:24:52.0

Homepage: null

Size: 19245

Language: Jupyter Notebook

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ICFPC 2017. Team kontur.ru

There're 16 members in team kontur.ru and here's the code we've written.

Code breakdown

Strategy:

Playing:

Visualization:

Quality control:

Monitoring:

Everything is written in C#, except for Online Statistics Monitor (JavaScript, HTML, CSS), Data Science Stuff (Python, Jupiter Notebook), and Ansible configs for Apache Kafka.

There're ready-to-use binaries for Brutal Tester, Visualizer, Visualizer for Replays, and Punter. Run them with mono on Mac/Linux or execute them on Windows.

Key ideas

Note. Have a look at the task specification to better understand our ideas.

As one would expect from a team this large, we've conjured a lot of strategies. The most feasible ones are in lib/Strategies, including:

  1. An algorithm that extends a connected component of our rivers towards the closest reachable disconnected mine.
  2. A greedy algorithm with a variety of different cost functions.
  3. An evil algorithm that finds and takes over minimal cuts between mines, so that rivals can't connect them.
  4. A vicious algorithm that takes over all rivers that are directly connected to mines, so that weak unprepared rivals leave with nothing.
  5. An opening algorithm that calculates and connects safe but profitable futures with corresponding mines.
  6. An algorithm that starts new connected component in the best place on the map.

Obviously, we needed a way to make these strategies work together, and a way to decide which strategy works best on different maps and at different stages of the game.

Our final bot utilizes a priority list of strategies. That is, it selects and executes the best move (if any) of the highest priority strategy. Of course, a strategy can decide to do nothing and leave the decision to lower priority ones.

Final submission

At around 2 hours before the end of the contest we've conducted a mass tournament between various combinations of our strategies on 4-player and 8-player maps.

Some of them had pretty good win rates, some failed miserably, but in the end this was our final submission:

  1. If both options and futures are available:

    1. Select a path of length ~sqrt(N of sites) that: ? includes a lot of mines; ? is highly connected (evaluated by calculating minimal cuts).
    2. Put as many futures as we can on this path, and put their targets as far away from mines as we can (but still on the chosen path).
    3. Try hard to connect all of these points (futures and corresponding mines) into one connected component.
    4. As soon as this happens or is no longer possible, continue by extending connected components towards the closest disconnected mine.
    5. As soon as all mines are connected into a single component or it is no longer possible, take other rivers greedily.
    6. Use options if necessary.
  2. If there are either no options or no futures enabled:

    1. Start a connected component from a mine that is close to other mines.
    2. Extend this component towards the closest reachable disconnected mine.
    3. If this becomes impossible, start a new component from another mine that is close to other disconnected mines.
    4. As soon as all mines are connected into components or it is no longer possible, take other rivers greedily.
Members

Alexey Dubrovin @Griboedoff

Alexey Kirpichnikov @beevee

Alexey Kungurtsev @KungA

Andrew Kostousov @AndrewKostousov and Ivan Dashkevich @spaceorc

Anton Tolstov @anaym

Denis Ionov @BadW0lf

Grigory Ovchinnikov

Igor Lukanin @igorlukanin

Michael Khrushchev

Michael Samoylenko @SkyterX

Pavel Ageev

Pavel Egorov @xoposhiy

Stanislav Fedjanin @BurningMarshmallow

Timofey Yefimov @anotherbugmaster

Yuri Okulovsky @okulovsky

Our apps during the contest

Visualizer:

Visualizer

Brutal Tester benchmarking dozens of strategies:

Brutal Tester

Online Statistics Monitor and Online Game Monitor, respectively:

Online Monitors


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.