Beta

Chess Overview

This is vanilla chess with no bells and whistles. Our engine implements all standard stalemate rules:

  • Insufficient Material
  • Repetition
  • Fifty Move Rule

Moves are written in UCI: the square a piece leaves and the square it reaches, as in e2e4. A pawn reaching the last rank adds the piece it becomes, q, r, b or n, as in e7e8q. Castling is the king’s move, e1g1, and a capture en passant is the capturing pawn’s two squares. For help on strategy visit the chess programming wiki.

Details

Time per move Each algo gets 300,000 milliseconds (5 minutes) total to finish the entire game. This emulates a real life chess clock, and like a real clock it only runs while it is your turn - thinking ahead in on_update while your opponent is to move is free. (We are still figuring out the best amount of time to provide for our games. This is subject to change.)
Ranking system Each ranked version has a strength, worked out from every ranked match of Chess ever played: who beat whom, with a draw counting as half a win each. The gap between two strengths is the odds of one beating the other: equal strengths are an even match, a gap of 1 is about 73% to the stronger, and a gap of 2 about 88%. Zero is the average of the versions the leaderboard was last updated for: those set to Ranked at the time that had played a ranked match. So a strength above zero is better than the average of them. The leaderboard is ordered by strength, and its Uncertainty column says how far off a strength may still be; it shrinks as the version plays. A newly ranked version is in trials until its uncertainty is 0.5 or less: its ranked matches are played and you can see its numbers under My Algos, but it has no place on the leaderboard yet. That takes about fourteen close matches, and more if they are one-sided. Ranked matches go to the pairs that would teach the most: two versions of similar strength, at least one of them still uncertain. So a new version plays a lot at first, against opponents closer and closer to its own strength. Which of the two plays white is chosen at random for each match. A version's code never changes, so every ranked match it has ever played counts, even if you take it out of ranking and put it back.
setup(color) color is a string representing the color your algo is playing. This will be 'w' if your algo is white or 'b' if your algo is black.
Valid moves A string that is one of ChessGameState.all_valid_moves for the current game state. Nothing else is played.
## Sample Algo

This is the starter algo the local app fills a seat with, so it is the same code you can run and edit.

import random

from algogames import ChessInterface

my_color = None


def setup(color):
    global my_color
    my_color = color


def on_update(state):
    # Every board, including the one your own move just produced.
    ChessInterface.log(state.board)


def on_my_turn(state):
    # Only the boards it is your move on, which is where a move belongs: the
    # engine plays one move at a time, and moving out of turn forfeits the game.
    ChessInterface.make_move(random.choice(state.all_valid_moves))