Back
Close
  • 8

What will I learn?

Monte Carlo tree search

Statement

This is a league based challenge.

For this challenge, multiple versions of the same game are available. Once you have proven your skills on this first version, you will access a higher league and extra rules will be unlocked.
In the first leagues, you will play on your own grid but in higher leagues, you will play on the same grid.

  Objectif

This game is inspired by the Langton's ant.
The game is played in two times : First, each player chooses to color tiles on the grid. Then, an ant move from the center of the grid changing the color of tiles along the way.
The goal is to have most of tiles colored with our color.

  Rules

In this league, both players play on their own grid.

First, each player chooses to color tiles on the grid. Then, an ant move from the center of the grid changing the color of tiles along the way.

To move, the ant play by the following rules :
If the ant is on a colored tile, it turns left, becomes of the tile's color, then the tile become white and the ant move forward on the next tile.
If the ant is on a white tile, it turns right and the tile become of the ant's color, then the ant move forward on the next tile.

At the beginning, the ant has the first player's color and is centered (more precisely on the tile of coordinates (dimension /2;dimension /2)) and its direction is upward

If the ant exit the grid, the game is over.


Victory Conditions
  • Have more colored tiles than your opponent.
Loss Conditions
  • Have less colored tiles than your opponent.
  • You do not respond in time or output an unrecognized command.

  Input

Initial input
Line 1: The dimension of the square grid.
Line 2: The number number_rounds of tiles each player will choose.
Line 3: The number path_length of steps of the ant.
Input for one game turn
Line 1: Two integers separated by a space opponentRow and opponentCol corresponding to the coordinates of the tile chosen by the opponent in the previous round(-1 -1 for the first turn).
Output for one game turn
One line: Two integers separated by a space row and col corresponding to the coordinates of the tile chosen.
Constraints
dimension=15
numberRounds=20
pathLength=150
Response time per turn≤300ms
Join

A higher resolution is required to access the IDE

codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants