Cookie settings

We use analytics cookies to improve the service. Learn more

ALPHANO Logo

Gomoku

Top PlayerSubmissionsParticipants

Problem

Two players play a game of Omok on a 15×1515 \times 15 board.

The board consists of 225225 cells, ranging from row 11 and column 11 to row 1515 and column 1515. A cell at the xx-th row and yy-th column is denoted as (x,y)(x, y).

Each cell can be in one of three states: an empty cell ., the first player's stone B, or the second player's stone W. Initially, the stones are arranged as follows:

State Count Initial Placement
Empty cell . 225225 Entire board from (1,1)(1, 1) to (15,15)(15, 15)
First-player stone B 00 None
Second-player stone W 00 None

The game begins with the first player, and the two players take turns.

During their turn, a player selects an empty cell (x,y)(x, y) and places their stone.

Below is an example of the first player placing a stone at (10,8)(10, 8):

The game ends when any of the following conditions are met:

  • If 55 or more identical stones are placed consecutively in a horizontal, vertical, or diagonal direction, the player who placed those stones wins.
  • If all cells on the board are filled but no player has met the winning condition, the game ends in a draw.

Please design an AI to become the ultimate winner of the board!

Input

The judge program communicates with the agent using single-line text commands as follows:

Command Judge → Agent (Input) Agent → Judge (Output) Time Limit (ms) Description
READY READY (FIRST or SECOND) OK 3000 Informs whether you are the first or second player.
TURN TURN my_time opp_time MOVE x y my_time Informs your remaining time and the opponent's remaining time. Output the chosen (x,y)(x, y).
OPP OPP x y time - - Informs the opponent's last move and the time they used.
FINISH FINISH - - Signals the end of the game. The agent must terminate normally without further output.
  • x, y are integers.
  • my_time, opp_time, and time are integers representing time in milliseconds.
  • After every output, you must print a newline character and flush the buffer.
  • Failure to output within the time limit results in a Time Limit Exceeded (TLE) verdict.
  • Outputting an invalid format or an illegal move during a TURN command results in a Runtime Error (RE) verdict.

Example

First Player Input First Player Output Second Player Input Second Player Output
READY FIRST READY SECOND
OK OK
TURN 10000 10000
MOVE 8 8
OPP 8 8 50
TURN 10000 9950
MOVE 9 8
OPP 9 8 20
... ... ... ...
FINISH FINISH

Sample Code

Limit

  • Time: In the first TURN command, my_time is 20,000ms20{,}000\mathrm{ms} for each player.
  • Memory: 1,024MB1{,}024\mathrm{MB}
  • Judge environment: HELP > Judge environment