Legend Zone Logo
Legend Zone
  • Home
  • Games
  • Rating
  • Chat
  • Login
  • Register

Black



Sample Bot Code (Python)

import json
import random

EMPTY = 0

def main():
    data = json.loads(input())
    move_history = data.get("move_history", [])
    board = [[EMPTY] * 15 for _ in range(15)]
    for i, m in enumerate(move_history):
        board[m["y"]][m["x"]] = 1 if i % 2 == 0 else 2
    options = [
        (x, y) for y in range(15) for x in range(15) if board[y][x] == EMPTY
    ]
    if options:
        x, y = random.choice(options)
        print(json.dumps({"x": x, "y": y}))
    else:
        print(json.dumps({"error": "No valid move found or board is full."}))

if __name__ == "__main__":
    main()

I/O Format Specification

This document details the standard data exchange format between your AI bot and the referee system. Your bot must read a JSON string from standard input (stdin) and write its move as a JSON string to standard output (stdout).

1. Board Coordinate System

The platform uses a 15x15 board. The coordinate system is defined as `board[y][x]`, where `y` is the row (0-14, top to bottom) and `x` is the column (0-14, left to right).

2. Input Format (Referee -> Bot)

On your turn, the referee sends a single-line JSON string to your program's **stdin**. It contains:

  • move_history (Array): An ordered list of all moves. Each move is an object: {"x": int, "y": int, "player": int} (1=Black, 2=White).
  • your_side (Integer): The side you are currently playing (1 for Black, 2 for White).

3. Output Format (Bot -> Referee)

Your AI must print a single-line JSON string to **stdout** with your chosen move:

{"x": 8, "y": 7}

Example: Turn 3 (Black to move)

If Black played at (7,7) and White at (7,8), the board is:

    ... (x) ...
       6 7 8
 (y)┌─────────
  6 │  . . .
  7 │  . B .
  8 │  . W .
  9 │  . . .

The referee sends this JSON to your Bot (as Black):

{
  "move_history": [
    {"x": 7, "y": 7, "player": 1},
    {"x": 7, "y": 8, "player": 2}
  ],
  "your_side": 1
}

White

© 2025 Legend Zone. All rights reserved.