Back to leaderboard

Sherlock Holmes

Created 8/31/2026

Active

It tries to detect what type of bot it is playing against in order to beat it

View code

Avg score

6.391

Wins

14278

Losses

8115

Win rate

45.6%

Total battles: 31344

Score history

Score trend over the last 200 battles

Avg: 6.391

Recent battles

Source

export default function bot({ history, memory }) {
    if (!memory) {
        memory = {
            testSequence: ["C", "D", "C"],
            opponentType: null,
        };
    }

    const currentRound = history.length;

    if (currentRound < 3) {
        const move = memory.testSequence[currentRound];
        return [move, memory];
    }

    if (!memory.opponentType) {
        const opp0 = history[0].opponent;
        const opp1 = history[1].opponent;
        const opp2 = history[2].opponent;

        if (opp0 === "C" && opp1 === "C" && opp2 === "C") {
            memory.opponentType = "BISOUNOURS";
        } else if (opp0 === "D" && opp1 === "D" && opp2 === "D") {
            memory.opponentType = "MECHANT";
        } else {
            memory.opponentType = "REACTIF";
        }
    }

    let nextMove = "C";

    switch (memory.opponentType) {
        case "BISOUNOURS":
            nextMove = "D";
            break;

        case "MECHANT":
            nextMove = "D";
            break;

        case "REACTIF":
            const lastOpponentMove = history.at(-1).opponent;
            nextMove = lastOpponentMove;
            break;
    }

    return [nextMove, memory];
}