Beta
Overview
Snake
Game State
Engine Interface
Duel Snakes
Game State
Engine Interface
Chess
Game State
Engine Interface

Duel Snakes Overview

Duel Snakes has the same mechanics as Snake, but your algo competes against another to see who can survive the longest. There are also five apples on the board at all times instead of one.

Details

Time per move 1,000 milliseconds (We are still figuring out the best amount of time to provide for our games. This is subject to change.)
Ranking system The algos are ranked based on win percentage (we plan to change this to some sort of Elo system).
Algo initializing config config['start_pos'] is a numpy array for the (row, column) coordinates of your starting position. This will be either [12, 2] or [12, 23].
Valid moves 0, 1, 2, or 3 which correspond to north, east, south, and west respectively.

Sample Algo

class Algo:


    def __init__(self, config: dict):
        self.start_position = config['start_pos']


    def take_turn(
        self, 
        state: DuelSnakesGameState, 
        interface: DuelSnakesInterface
    ) -> int:
        # Unpack state data
        snake = state.snakes[0]
        head = snake[0]
        direction = state.directions[0]
        apple = state.apples[0]
        

        # Go directly towards apple
        # Select direction based on snake head position and apple position
        if head[0] < apple[0]:

            # If snake is currently going north, it cannot turn south
            if direction == interface.N:
                return interface.E
            else:
                return interface.S

        elif head[0] > apple[0]:

            # If snake is currently going south, it cannot turn north
            if direction == interface.S:
                return interface.E
            else:
                return interface.N

        elif head[1] < apple[1]:
            # If snake is currently going west, it cannot turn east
            if direction == interface.W:
                return interface.N
            else:
                return interface.E

        elif head[1] > apple[1]:

            # If snake is currently going east, it cannot turn west
            if direction == interface.E:
                return interface.N
            else:
                return interface.W