Back to leaderboard

Dilemma-Bot-Hackclub

Created 9/3/2026

Active

A bot which doesn't like betrayal. If you are friendly my bot will be friendly too and if not you will see tit-for-tat version of my bot.

View code

Avg score

8.420

Wins

1371

Losses

1623

Win rate

15.1%

Total battles: 9058

Score history

Score trend over the last 199 battles

Avg: 8.420

Recent battles

Source

export default function bot({ history, memory }) {

    if (memory === null) {
        memory = { betrayals: 0 };
    }

    if (history.length === 0) {
        return ["C", memory];
    }

    const lastOpponentMove = history.at(-1).opponent;

    if (lastOpponentMove === "D") {
        memory.betrayals += 1;
    }

    if (memory.betrayals >= 3) {
        return ["D", memory];
    }

    return [lastOpponentMove, memory];
}