Open AI Championship

Quick start

Project

Sandbox

Round 1

Round 2

Finals

Recent comments

19 february 23:14: karloid wrote comment on post The closing of the Russian AI Cup 2018
19 february 13:38: tyamgin wrote comment on post The closing of the Russian AI Cup 2018
17 february 14:58: tsapelman wrote comment on post The closing of the Russian AI Cup 2018
13 february 09:15: Hal wrote comment on post The closing of the Russian AI Cup 2018
12 february 10:48: AlexKol wrote comment on post The closing of the Russian AI Cup 2018
12 february 10:48: AlexKol wrote comment on post The closing of the Russian AI Cup 2018
12 february 10:12: bearf wrote comment on post The closing of the Russian AI Cup 2018
11 february 17:54: tsapelman wrote comment on post The closing of the Russian AI Cup 2018
10 february 11:36: Scarlet wrote comment on post Finals: Results

VK Group

Telegram chat

 

We’ll show you how to join CodeBall in a few minutes.

Register

Of course, you need to register. We kindly ask all participants to provide accurate and complete information about yourself.

Download language pack

Download the package for your favorite programming language from the language packs page. We support C++, Java, C#, Python 3, Ruby, Kotlin, Rust. Unzip the archive and open an existing project or create a new one from scratch. You may need to configure some paths.

Download Local runner

Local runner is a special version of game engine adapted for participants. Local runner gives you the opportunity to run a test games locally on your computer. Read more about it here.

Read the documentation

The official and complete rules are published in the Rules section, please read them. Some organizational aspects you can find in the descriptions of the Sandbox and stages of the championship (Round 1, Round 2, Finals).

Submit your strategy

You can submit you strategy here. Before the system will accept your strategy, it will be compiled and tested in a few short games. If everything is OK, your strategy will automatically start to participate in regular qualifying games in Sandbox. Carefully read the section “What you should pay attention to” for various aspects due to which your strategy can get the “Verification error” verdict. The total number of submissions are not restricted, however there are restrictions on too frequent submitting. Any attempt to destabilize the system will result in disqualification. You can write your strategy in an arbitrary number of files, you will only need to pack everything into a ZIP archive and send it. All files must be in root of archive. Unfortunately, creating custom packages in the Java strategy is unacceptable. Remember that in your starter pack you can change only the file MyStrategy.${ext} (where ${ext} — extension language you are using), and even if you change some other file and also add it to the archive, it will be replaced on standard (except for MyStrategy.h in C++).

What you should pay attention to

  • it is prohibited to interact with the network, file system and other resources, except for RAM and the current directory, violators will be disqualified;
  • total CPU time of your strategy process is limited (exact details you can find in the documentation);
  • the strategy process should not use more than 256 MB of RAM;
  • if your strategy exceeds the time or memory limit or crashes during the execution, it stops to participate in this game (however, your score points do not expire);
  • the strategy of each participant runs in a separate process.

Writing a simple strategy with Rust

Quick start strategies in some other languages are available on GitHub.

Simple strategy tries to hit the ball as soon as possible, not neccesarily into the net, just in opponent’s side of the arena.

It also does not take collisions into account, as well as y coordinate — only 2d geometry is used.

use crate::model::*;
use crate::strategy::Strategy;

const EPS: f64 = 1e-5;

#[derive(Default)]
pub struct MyStrategy;

// We will need to work with 2d vertors
#[derive(Copy, Clone, Debug)]
struct Vec2 {
    x: f64,
    y: f64,
}

impl Vec2 {
    fn new(x: f64, y: f64) -> Self {
        Self { x, y }
    }
    // Finding length of the vector
    fn len(&self) -> f64 {
        (self.x * self.x + self.y * self.y).sqrt()
    }
    // Normalizing vector (setting its length to 1)
    fn normalize(self) -> Self {
        self * (1.0 / self.len())
    }
}

// Subtraction operation for vectors
impl std::ops::Sub for Vec2 {
    type Output = Self;
    fn sub(self, b: Self) -> Self {
        Self::new(self.x - b.x, self.y - b.y)
    }
}

// Addition for vectors
impl std::ops::Add for Vec2 {
    type Output = Self;
    fn add(self, b: Self) -> Self {
        Self::new(self.x + b.x, self.y + b.y)
    }
}

// Multiplying vector by a number
impl std::ops::Mul<f64> for Vec2 {
    type Output = Self;
    fn mul(self, k: f64) -> Self {
        Self::new(self.x * k, self.y * k)
    }
}

// Common interface for ball and robots
trait Entity {
    // Position of the entity in XZ plane
    fn position(&self) -> Vec2;
    // Velocity of the entity in XZ plane
    fn velocity(&self) -> Vec2;
}

impl Entity for Robot {
    fn position(&self) -> Vec2 {
        Vec2::new(self.x, self.z)
    }
    fn velocity(&self) -> Vec2 {
        Vec2::new(self.velocity_x, self.velocity_z)
    }
}

impl Entity for Ball {
    fn position(&self) -> Vec2 {
        Vec2::new(self.x, self.z)
    }
    fn velocity(&self) -> Vec2 {
        Vec2::new(self.velocity_x, self.velocity_z)
    }
}

// Strategy logic
impl Strategy for MyStrategy {
    fn act(&mut self, me: &Robot, rules: &Rules, game: &Game, action: &mut Action) {

        // The strategy only plays on the ground
        // So, if we are not touching the ground, use nitro
        // to go back as soon as possible
        if !me.touch {
            *action = Action {
                target_velocity_x: 0.0,
                target_velocity_y: -rules.MAX_ENTITY_SPEED,
                target_velocity_z: 0.0,
                jump_speed: 0.0,
                use_nitro: true,
            };
            return;
        }

        // Lets jump if we would hit the ball, and
        // we are on the same side of the ball as out net, so 
        // the ball would go into opponent's side of the arena
        let jump = ((me.x - game.ball.x).powi(2)
            + (me.y - game.ball.y).powi(2)
            + (me.z - game.ball.z).powi(2))
        .sqrt()
            < rules.BALL_RADIUS + rules.ROBOT_MAX_RADIUS
            && me.z < game.ball.z;

        // Since there are multiple robots in out team lets determine out role - attacker or defender
        // We will be attacker if there is friendly robot closer
        // to out net than current one.
        let mut is_attacker = game.robots.len() == 2;
        for robot in &game.robots {
            if robot.is_teammate && robot.id != me.id {
                if robot.position().y < me.position().y {
                    is_attacker = true;
                }
            }
        }

        if is_attacker {
            // Attacker strategy:
            // Simulate approximate location of the ball for the next 10 seconds with 0.1 second precision
            for i in 1..100 {
                let t = i as f64 * 0.1;
                let ball_pos = game.ball.position() + game.ball.velocity() * t;
                // If ball will not leave arena boundary
                // (collision with the arena would happen, but we are not considering it),
                // and the ball will be closer to opponent's net than the robot,
                if ball_pos.y > me.position().y
                    && ball_pos.x.abs() < (rules.arena.width / 2.0)
                    && ball_pos.y.abs() < (rules.arena.depth / 2.0)
                {
                    // Compute the speed robot needs to run with
                    // To be at ball's location at the same time as the ball
                    let delta_pos = Vec2::new(ball_pos.x, ball_pos.y)
                        - Vec2::new(me.position().x, me.position().y);
                    let need_speed = delta_pos.len() / t;
                    // If the speed is in acceptable range
                    if 0.5 * rules.ROBOT_MAX_GROUND_SPEED < need_speed
                        && need_speed < rules.ROBOT_MAX_GROUND_SPEED
                    {
                        // Then this is out action
                        let target_velocity =
                            Vec2::new(delta_pos.x, delta_pos.y).normalize() * need_speed;
                        *action = Action {
                            target_velocity_x: target_velocity.x,
                            target_velocity_y: 0.0,
                            target_velocity_z: target_velocity.y,
                            jump_speed: if jump { rules.ROBOT_MAX_JUMP_SPEED } else { 0.0 },
                            use_nitro: false,
                        };
                        return;
                    }
                }
            }
        }
        // Defender's strategy (or attacker's who did not find good moment):
        // Standing in the middle of out net
        let mut target_pos = Vec2::new(0.0, -(rules.arena.depth / 2.0) + rules.arena.bottom_radius);
        // And, if the ball is rolling towars it
        if game.ball.velocity().y < -EPS {
            // Find time and place where ball crosses the net line
            let t = (target_pos.y - game.ball.position().y) / game.ball.velocity().y;
            let x = game.ball.position().x + game.ball.velocity().x * t;
            // If this place is inside the net
            if x.abs() < (rules.arena.goal_width / 2.0) {
                // Go defend there
                target_pos.x = x;
            }
        }

        // Setting fields of the needed action
        let target_velocity = Vec2::new(
            target_pos.x - me.position().x,
            target_pos.y - me.position().y,
        ) * rules.ROBOT_MAX_GROUND_SPEED;
        *action = Action {
            target_velocity_x: target_velocity.x,
            target_velocity_y: 0.0,
            target_velocity_z: target_velocity.y,
            jump_speed: if jump { rules.ROBOT_MAX_JUMP_SPEED } else { 0.0 },
            use_nitro: false,
        }
    }
}


SilentNox

SilentNox

Miass

Make the web client the ability to view the matches tick by tick, that is, to skip one tick forward or backward.

Dec 17, 2018 1:35:56 AM
m4shell

In the section language packs says : “Download the package to your favorite programming language from the page language packs. Supported C++, Java, C#, Pascal, Python2, Python3, and Ruby.”

But the package is for Python 2 is not lined. Will there be support for a second Python?

Dec 17, 2018 12:22:38 PM
nekromant322

Is there any example MyStrategy in Java? The easiest and most obvious to the most stupid

Dec 17, 2018 9:13:22 PM
DonRumata

DonRumata

Saint Petersburg State Polytechnic University

Is there any example MyStrategy in Java? The easiest and most obvious to the most stupid

Shown in Rust’e example is relatively easy to migrate, did the same for the pros. Can’t say that much in the pros understand, and Rust in General saw for the first time in my life, but much time is it didn’t take me. Longer fiddling with the connection windowas libraries for sockets.

Dec 17, 2018 10:12:59 PM
Scarlet

I don’t understand something. Translate this example to C++, and most of the games on the site are, and some are actively moving (http://russianaicup.ru/game/view/773, http://russianaicup.ru/game/view/847). I tried to create a game with the same versions of the same thing: in one both sides are in the other on the one hand are, on the other play (http://russianaicup.ru/game/view/733, http://russianaicup.ru/game/view/1202). How can a strategy so different? Unfortunately, the x86 localendar not brought up, repeater, too, so you can debug while you can only at random, flooding the site.

Dec 18, 2018 9:14:44 AM
chippie

chippie

Moscow

How to understand the cause of the error verification?

Dec 18, 2018 11:32:57 PM
sergeavel

sergeavel

Xing Events

When sending strategy (Ruby) I receive an error File ._remote_process_client.rb has incorrect name

Tried to get the downloaded files of the Language packs (not even changing), the error is slightly different File Dockerfile has incorrect name

Please tell me that you want to include in the archive?

Dec 18, 2018 11:54:21 PM
alkozel

alkozel

Калужский филиал ГУ СДА при Спецстрое России

I don’t understand something. Translate this example to C++, and most of the games on the site are, and some are actively moving ( http://russianaicup.ru/game/view/773 , http://russianaicup.ru/game/view/847) . I tried to create a game with the same versions of the same thing: in one both sides are in the other on the one hand are, on the other play ( …

maybe on the same line appear and the strategy can not share the defender and the attacker. there’s sort of an accurate comparison on the choice of position.

Dec 19, 2018 12:33:13 AM
romasffm

romasffm

Bad Soden am Taunus

Give Tensorflow or at least NumPy! or TF for Java at least?

Long time no one not ask about it :)

Tensorflow not yet compatible with PYTHON 3.7, maybe 3.6 PYTHON, it’s unlikely to hurt someone?

Or at least NumPy?!…

But you can Tensorflow for Java, then you can train locally in Python and send the bot in Java.

Guys-the organizers, a question for you: if I can do something, eh?

Respond better here on the forum, it is more convenient: http://russianaicup.ru/forum/index.php?topic=900.0

Dec 19, 2018 12:41:09 AM
romasffm

romasffm

Bad Soden am Taunus

import java.util.Random;

import model.Action; import model.Game; import model.Robot; import model.Rules;

public final class MyStrategy implements Strategy { double ROBOT_MAX_GROUND_SPEED = 30; double ROBOT_MAX_JUMP_SPEED = 15.1;

Random rng = new Random();

@Override public void act( final Robot me, Rules, final rules, final Game game, final Action action ) { action.target_velocity_x = rng.nextGaussian() * ROBOT_MAX_GROUND_SPEED; action.target_velocity_y = rng.nextGaussian() * ROBOT_MAX_GROUND_SPEED; action.target_velocity_z = rng.nextGaussian() * ROBOT_MAX_GROUND_SPEED;

if( rng.nextInt( 5 ) == 0 ) action.jump_speed = rng.nextGaussian() * ROBOT_MAX_JUMP_SPEED; } }

Dec 19, 2018 12:54:46 AM
romasffm

romasffm

Bad Soden am Taunus

Is there any example MyStrategy in Java? The easiest and most obvious to the most stupid

import java.util.Random;

import model.Action; import model.Game; import model.Robot; import model.Rules;

public final class MyStrategy implements Strategy { double ROBOT_MAX_GROUND_SPEED = 30; double ROBOT_MAX_JUMP_SPEED = 15.1;

Random rng = new Random();

@Override public void act( final Robot me, Rules, final rules, final Game game, final Action action ) { action.target_velocity_x = rng.nextGaussian() * ROBOT_MAX_GROUND_SPEED; action.target_velocity_y = rng.nextGaussian() * ROBOT_MAX_GROUND_SPEED; action.target_velocity_z = rng.nextGaussian() * ROBOT_MAX_GROUND_SPEED;

if( rng.nextInt( 5 ) == 0 ) action.jump_speed = rng.nextGaussian() * ROBOT_MAX_JUMP_SPEED; } }

Dec 19, 2018 12:59:57 AM
Scarlet
alkozel

alkozel

Калужский филиал ГУ СДА при Спецстрое России

maybe on the same line appear and the strategy can not share the defender and the attacker. there’s sort of an accurate comparison on the choice of position.

No, it’s not accurate: if robot.position().y < me.position().y. Besides, the position of each round varies, and the situation is that either the whole game worth it. either the entire game run. Yes, and not only at me such glitches and not just for the pros.

Dec 19, 2018 6:41:20 AM
Scarlet

By the way, 11 am yesterday, all the party robots running around. Perhaps something was fixed. And strategy now burst out, which first filled, and then did not pass the verification.

Dec 19, 2018 6:55:41 AM
aplayt

aplayt

Moscow

And why in the example of these two constants?

const JUMP_TIME: f64 = 0.2; const MAX_JUMP_HEIGHT: f64 = 3.0;

Dec 19, 2018 1:25:34 PM
frau.medved

Can’t send the strategy for the Kotlin - error : the File ._MyStrategy.kt has a malformed name. The archive contains two Faya: MyStrategy.kt and Vector.kt What’s wrong?

Dec 20, 2018 6:40:50 PM
snikes

snikes

РГППУ

Accepting the strategy http://prntscr.com/lxm6ha

All right? sent one and the same, which is accepted (the tick test) Stopped after the package upgrade

Dec 20, 2018 10:42:50 PM
mixei4

mixei4

КГУ

snikes

snikes

РГППУ

Accepting the strategy http://prntscr.com/lxm6ha All right? sent one and the same, which is accepted (the tick test) Stopped after the package upgrade

Yesterday, too, after a time I accepted.

Dec 20, 2018 11:38:48 PM
amurushkin

amurushkin

ХНУРЭ (бывш. ХИРЭ, ХТУРЭ)

snikes

snikes

РГППУ

Accepting the strategy http://prntscr.com/lxm6ha All right? sent one and the same, which is accepted (the tick test) Stopped after the package upgrade

the same garbage. already 4 attempt

Dec 21, 2018 12:49:47 AM
dfomin

dfomin

Larnaca

There is a problem with obtaining the constants of the game, like the maximum speed of the robot. Judging by the code they are extracted from the json that poisons local-runner, but the version for Mac does not send constants and everywhere None. Has anyone ever had this same problem? It is clear that all constants can be copied from the pdf with the rules, but I want to make sure I do it right.

Dec 23, 2018 2:37:17 AM
dfomin

dfomin

Larnaca

dfomin

dfomin

Larnaca

There is a problem with obtaining the constants of the game, like the maximum speed of the robot. Judging by the code they are extracted from the json that poisons local-runner, but the version for Mac does not send constants and everywhere None. Has anyone ever had this same problem? It is clear that all constants can be copied from the pdf with the rules, but I want to make sure I do it right.

Apparently the problem is that Mac posted are out of date local-runner

Dec 23, 2018 2:54:43 AM
cahq

cahq

Saint Petersburg

in the package C# IStrategy has no method string CustomRendering(), and the attempt to send the strategy it is not compileda, by reason of his absence. Disorder.

Dec 23, 2018 3:49:27 AM
AlexKol

AlexKol

BB

cahq

cahq

Saint Petersburg

in the package C# IStrategy has no method string CustomRendering(), and the attempt to send the strategy it is not compileda, by reason of his absence. Disorder.

New version take. It’s all there

Dec 23, 2018 6:48:15 AM
QaraByte

https://ibb.co/6tSPVwg Why error comes: “The default XML namespace of the project must be the MSBuild XML namespace…”

Dec 23, 2018 9:35:53 AM
tanujyadav97

tanujyadav97

NIT Delhi

Does the strategy run as a separate process for each robot of the team?

Dec 25, 2018 3:48:07 PM
Flutter

Flutter

Nitka Technologies

tanujyadav97

tanujyadav97

NIT Delhi

Does the strategy run as a separate process for each robot of the team?

No, one after another. You can differ robots by Id.

Dec 25, 2018 4:00:26 PM
code2travel

code2travel

IIT Kharagpur

Submitted a strategy about 20 hrs ago, but has yet not been called for any game by the system. Neither I am able to create any game with my strategy as a participant. Any probable reason?

Dec 27, 2018 6:48:14 AM
am13

am13

Hyderabad

how to make my strategy compete against itself

Dec 27, 2018 10:49:42 AM
Ancient_mage

Ancient_mage

Itransition

am13

am13

Hyderabad

how to make my strategy compete against itself

1) You can create game on web site with any your accepted strategy 2) Run Local Runner with –p1 tcp-31001 –p2 tcp-31002 and run 2 strategies on these ports: 31001 and 31002 (you can do this from command line)

Dec 27, 2018 1:14:08 PM
aj15

aj15

India

code2travel

code2travel

IIT Kharagpur

Submitted a strategy about 20 hrs ago, but has yet not been called for any game by the system. Neither I am able to create any game with my strategy as a participant. Any probable reason?

I am facing same problem. Do you see your name in the Sandbox Standings?

Dec 27, 2018 1:49:24 PM
kuviman

kuviman

СГУ им. Чернышевского

aj15

aj15

India

I am facing same problem. Do you see your name in the Sandbox Standings?

When submitting your strategy, do not check testing submit if you want your strategy to participate in sandbox

Dec 27, 2018 1:55:19 PM
aj15

aj15

India

kuviman

kuviman

СГУ им. Чернышевского

When submitting your strategy, do not check testing submit if you want your strategy to participate in sandbox

Thanks!

Dec 27, 2018 2:01:46 PM
am13

am13

Hyderabad

what happens if I give velocity greater than max velocity

Dec 27, 2018 3:30:28 PM
am13

am13

Hyderabad

Ancient_mage

Ancient_mage

Itransition

1) You can create game on web site with any your accepted strategy 2) Run Local Runner with –p1 tcp-31001 –p2 tcp-31002 and run 2 strategies on these ports: 31001 and 31002 (you can do this from command line)

Thanks

Dec 27, 2018 3:30:41 PM
Ancient_mage

Ancient_mage

Itransition

am13

am13

Hyderabad

what happens if I give velocity greater than max velocity

action.target_velocity = clamp(action.target_velocity, MAX_GROUND_ROBOT_SPEED). action.jump_speed = min(action.jump_speed, MAX_JUMP_ROBOT_SPEED). robot.velocity = clamp(robot.velocyt, MAX_ENTITY_SPEED).

Dec 27, 2018 3:48:30 PM
aj15

aj15

India

On what factors (apart from jump speed) does the strength of hitting the ball depend?

Dec 27, 2018 10:02:42 PM
am13

am13

Hyderabad

what is the difference (apart from an increase in radius) b/w giving target velocity in the y-direction and jump-speed? Also, does the entity always move as targeted or are there any special conditions?

Dec 29, 2018 3:53:16 PM
am13

am13

Hyderabad

what is the difference (apart from an increase in radius) b/w giving target velocity in the y-direction and jump-speed? Also, does the entity always move as targeted or are there any special conditions?

Dec 29, 2018 3:53:18 PM
mixei4

mixei4

КГУ

am13

am13

Hyderabad

what is the difference (apart from an increase in radius) b/w giving target velocity in the y-direction and jump-speed? Also, does the entity always move as targeted or are there any special conditions?

Setting Y in target_velocity has no effect if you are touching the floor.

Robots change velocity based on given acceleration.

Dec 29, 2018 7:55:44 PM
R4N4R4M4

R4N4R4M4

Lyon

am13

am13

Hyderabad

Thanks

Hi, how do you launch player on tcp 31002 please ?

Dec 29, 2018 8:31:35 PM
amurushkin

amurushkin

ХНУРЭ (бывш. ХИРЭ, ХТУРЭ)

R4N4R4M4

R4N4R4M4

Lyon

Hi, how do you launch player on tcp 31002 please ?

app.exe 127.0.0.1 31002 9000

Dec 29, 2018 8:53:25 PM
R4N4R4M4

R4N4R4M4

Lyon

amurushkin

amurushkin

ХНУРЭ (бывш. ХИРЭ, ХТУРЭ)

app.exe 127.0.0.1 31002 9000

thanx very much :D

Dec 29, 2018 8:57:00 PM
R4N4R4M4

R4N4R4M4

Lyon

amurushkin

amurushkin

ХНУРЭ (бывш. ХИРЭ, ХТУРЭ)

app.exe 127.0.0.1 31002 9000

thanx very much :D

Dec 29, 2018 8:57:01 PM
alkozel

alkozel

Калужский филиал ГУ СДА при Спецстрое России

People, tell me the precedence of binary operations in Rust

Dec 30, 2018 12:42:18 PM
Mahi

Mahi

Tehran Polytechnic

i need custom rendering in rust! How can I do?

Jan 2, 2019 1:07:53 PM
jMind

jMind

Moscow

What is the meaning of the line assert arena.bottom_radius == arena.goal_top_radius; in the pseudo-code of the simulator? What does the clamp when it is passed 3 parameters?

Jan 6, 2019 3:37:21 PM
mixei4

mixei4

КГУ

jMind

jMind

Moscow

What is the meaning of the line assert arena.bottom_radius == arena.goal_top_radius; in the pseudo-code of the simulator? What does the clamp when it is passed 3 parameters?

The line can be thrown out.

The first number limits the other two.

Jan 6, 2019 9:58:26 PM
Mahi

Mahi

Tehran Polytechnic

can we use filesystem just for the current directory?

Jan 9, 2019 1:57:47 AM
MrZlodey

MrZlodey

NetCracker

Mahi

Mahi

Tehran Polytechnic

can we use filesystem just for the current directory?

Nope

Jan 22, 2019 9:43:51 PM