Tutorial for Bot Programming on CodinGame

[CG]Thibaud
12.3K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Why this Playground?

Creating your first bot/AI on CodinGame can be daunting, even scary for some. A lot of great developers have told me they didn't know anything about AI/bot programming and that they were not sure they were good enough to start...

Let me tell you something.

If you know the basics of programming, you can write bots.

It's not a part of programming reserved for the elites or something. You can write bots.

Let me guide you!

What's Bot Programming on CodinGame?

Bot programming on CodinGame takes the form of multiplayer games where you write a program that is able to play a game. Once submitted into the arena, your bot is matched against hundreds of other bots and you get a rank accordingly.

Your program "plays" the game by reading the data sent by CodinGame on the Standard Input Stream and sending a command on the Standard Output Stream at every turn of the game until there is a winner or a end condition is met.

The game is divided into several leagues. You start in the Wood leagues with a simplified version of the game. When ranking up, you'll be promoted to new leagues: Bronze, Silver, Gold and finally Legend.

Getting Started

I've chosen Ghost in the Cell because it's simple enough and quite fun. Let's see how fast we can get to the Bronze league. I'd say it'll take you 30 minutes, maximum an hour.

I personally code in Java but the tutorial is pretty language-agnostic. So choose your favorite language in the drop-down above the code and let's get cracking!

Disclaimer: this tutorial aims at showing how easy and straightforward it can be to get started into a bot programming game. There are plenty of classic algorithms to use in bot programming, however it's not the focus of this tutorial.

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content