Rules

General

Submitting code

Example

This bot goes down until it reaches something, and then goes right.


    if (isFirstRound()) {
        // First round, initialize persistent variables
        hasTurned = false;
    }

    // Check if we have reached something
    if (!hasTurned) {
        let { x, y } = getSelfPosition();

        if (getCellContent(x, y - 1) !== null) {
            // The bottom cell is not empty
            hasTurned = true;
        }
    }

    if (hasTurned) {
        chooseMove("right");
    } else {
        chooseMove("down");
    }