Updated 14/08/2018

Artificial Intelligence programming is probably one of the most thrilling aspects of coding, though the field still remains relatively confidential. If you wish to practice AI coding, it is complicated to find suitable online frameworks. CodinGame tackles the issue on providing an easy-to-use and adapted development environment, with everything useful to discover – and improve – your AI coding skills.

Artificial Intelligence Programming

A simple definition of artificial intelligence by Scholkoff, R.J. (1990) is

“A field of study that seeks to explain and emulate intelligent behavior in term of computational processes”

There are a lot of different fields where AIs are useful such as robotics, machine learning, computer vision, etc.

Agents

One common technical approach to AI is the concept of a rational agent. An agent is a program that evolves in a specific environment, can perceive through sensors and act through actors. It takes decisions with its knowledge of the environment, rationally.

Agent vs environment in the artificial intelligence field

A simple representation of how an agent works

Environments

Each environment has its own characteristics. The most common are:

Known vs Unknown: whether or not you know something about how the environment will react. Example: a newborn child evolves in an unknown environment, he has to discover it before being able to react to it (that’s why he tests absolutely everything).

Accessible vs Inaccessible: agents have access or not to all environment variables that could be used for a decision. Example: when you play poker you don’t know the other players’ cards unless you’re are a cheater or Rain Man. It’s an inaccessible environment.

Deterministic vs Non-deterministic: the behavior of the environment is defined logically vs statistically. When you play chess, you are sure that an action will have a given consequence (deterministic). For a moving robot, you’re not absolutely sure of the behavior of the motors (non-deterministic).

Static vs Dynamic: whether or not the environment is changing while an agent is taking a decision. For a self-driving car, someone can appear on the road while the car is thinking about what to do next. It’s a dynamic environment.

Discrete vs Continuous:  a finite vs infinite number of possible actions for an agent.

It’s really important when designing an agent to know what kind of environment you are dealing with. It will guide you and help you avoid common mistakes. Be sure to understand your environment at 100% before writing a single line of code.

CodinGame & A.I.

We believe that we learn better by practicing a lot (and even better, when practice is fun). However, the process of creating an AI agent is complicated because you have to program the environment first.

You have to handle all communications between the environment and the agents (actors and sensors).

You have to develop all possible behaviors of the environment. Like all rules of a chess game for example.

And if you want something cool to share, you have to develop a graphical representation of the environment. It quickly becomes a hard and complex task.

We have designed a system that enables developers to focus on the intelligent part of an agent. The main goal is to simplify the process of moving from learning to practice.

The CodinGame Agent

Actors and sensors are simulated with standard output and input stream. An agent can modify the environment by printing some actions to the standard output stream. The agent can access all its sensors by reading on the standard input stream.

Here’s an agent’s Python default code on CodinGame:

import sys, math

# read global information about the environment on sensors

LX, LY, TX, TY = [int(i) for i in raw_input().split()]

while 1:   # infinite loop of sense / act

   E = int(raw_input()) # Read new information on the environment on sensors before making a decision

   # Intelligent (or dumb) processing

   print "SE" # Act on the environment with actors (here move to south-east)

We tried to remove the programming language barriers by offering over 20 programming languages on the platform.

The CodinGame Environment

We have created an abstract system which is able to handle all possible kinds of environment. Through it, we create the environment for you and we handle its behavior. You have access to a complete description of how the environment reacts. We also handle all communications between the environment and the agents.

To compare your agent’s performance, we created multiplayer games with leaderboards that allow you to benchmark your AI’s performance and to be automatically ranked according to other players’ AIs performances. To visualize the environment, we have developed a graphical representation for each environment. Our goal is to make debugging easier and coding really exciting!

Examples of Games

On CodinGame.com, we have 2 main categories of games:

  • Solo games: 1 agent in a given environment
  • Multiplayer games: 1 or more agents (multi-agents) and others players to beat

Solo Games

Power of Thor solo puzzle

Thor reaches the Light

Mars Lander coding puzzle

Better land this rocket safely!

The Last Crusade coding puzzle

Help Indy to leave the maze

Multiplayer Games

  • The Great Escape: known, accessible, deterministic, static, discrete with one agent
The Great Escape coding game

Find the shortest path to the other side

  • Platinum Rift: known, accessible, deterministic, static, discrete with multiple agents
Platinum Rift Coding Game

Conquer back the planet Earth

  • Platinum Rift 2: known, inaccessible, deterministic, static, discrete with multiple agents
Platinum Rift 2 coding game

Platinum Rift reloaded!

  • Poker Chip Race: known, accessible, deterministic, dynamic, continuous, multiple agents
Poker Chip Race coding war

No bluff allowed

  • Games of Drones: known, accessible, deterministic, static, continuous with multiple agents
Game of Drones coding battle

Control the Krysal zones for the win!

  • Tron Battle: known, accessible, deterministic, static, discrete with one agent
Tron Battle coding game

Ride your light cycle to the end of the world

The Future of Artificial Intelligence on CodinGame

We would like to create more of these games to cover all kind of environments (non-deterministic, unknown, …), therefore, we are open to any new ideas: please help us be inspired!

We are also thinking about a learning platform where you could both learn and practice AI in the same place. Would you personally be interested in learning AI this way?

To learn more about Artifical Intelligence and how to develop a great agent: